正如標題所說,我有這個JavaScript當前正在由單選按鈕控制的,但我想它改爲由超級鏈接如何打開JavaScript來一個鏈接激活此單選按鈕的JavaScript
的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';
}
}
當前HTML表單(單選按鈕):
<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>
我要如何控制它:
<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>
說不上你在問什麼。你能澄清還是增加更多解釋? – 2010-12-17 16:31:36
我在問如何修改上面的JavaScript代碼與鏈接而不是單選按鈕關聯。 – NewB 2010-12-17 16:33:31