Just as the title says, I have this javascript that is currently being controlled by radio buttons but I want it changed to be controlled by a hyperlink
Javascript:
function Init()
{
document.role_form.reset();
document.host_form.reset();
document.guest_form.reset();
//MBR Code: Use querystring to initialize the form
var sRole = GetQueryString()["role"];
if (sRole) {
SelectRole(sRole)
if (sRole != '')
{
document.role_form.role[0].checked = sRole.toLowerCase() == 'host';
document.role_form.role[1].checked = sRole.toLowerCase() == 'guest';
}
}
current HTML form (Radio buttons):
<form name="role_form">
<p align="center" style="FONT-SIZE:12px; COLOR:#000000; TEXT-ALIGN:center">
<input name="role" id="role" type="radio" value="host" onClick="SelectRole('host')">
<span class="blackbodymain ">Host </span>
<input name="role" id="role" type="radio" value="guest" onClick="SelectRole('guest')">
<span class="blackbodymain ">Participant </span></p>
</form>
And how I want to control it:
<ul id="loginmenu">
<li class="active"><a href="#host" onClick="SelectRole('host')">Host</a></li>
<li><a href="#participant" onClick="SelectRole('guest')">Participant</a></li>
</ul>
Perhaps the problem has something to do with what is returned from selectRole. I don't know because I can't see it, but link wont happen if the function returns false (or something evaluated to false)
<li class="active"><a href="#host" onclick=selectAndGo('host')">Host</a></li>
<li><a href="#guest' onclick='selectAndGo('guest')">Participant</a></li>
And in the javascript
function selectAndGo(arg)
{
selectRole(arg);
return true;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.