jascript中radio及checkbox應用

來源:互聯網
上載者:User

document.form.radio1.checked

document.form.radio1.value

 

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>當前位置</title>
</head>

<body>
<script language="javascript">
function CheckLogin() {
var t=document.Login.Type; 
var TF=false;
for (i=0 ; i<t.length;i++)

if (t[i].checked)
{   
TF=true; break; 
}
}

if (TF==false) 
{   
alert("請選擇使用者類型!"); 
return false; 
}

if (document.Login.UserName.value=="") 
{   
alert("請輸入使用者名稱!"); 
document.Login.UserName.focus(); 
return false; 
}

if (document.Login.PassWord.value=="") 
{   
alert("請輸入密碼!"); 
document.Login.PassWord.focus(); 
return false; 

}
</script> 
<table width="980" align="center"  border="0" cellspacing="0" cellpadding="0" class="m_bg_t">
<form name="Login" action="ChkLogin.asp" onSubmit="return CheckLogin()"> 
<tr>   
<td width="20%">&nbsp; &nbsp;當前位置:<a href='../'>首頁</a> -->> <a href='../PersonInfor/'>個人服務</a> </td>   
<td width="6%"class="td_pb5"><input type="radio" name="Type" value="1" />    個人</td>   

<td width="2%"><img src="../images/geren_icon.gif" width="10" height="16" /></td>   
<td width="6%" class="td_pb5"><input type="radio" name="Type" value="2" />    企業</td>

<td width="2%"><img src="../images/qiye_icon.gif" width="10" height="16" /></td>   

<td width="6%">使用者名稱:</td>   
<td width="14%"><input name="UserName" type="text"class="input_zc" id="UserName" size="20" maxlength="20" /></td>   
<td width="5%"><div align="center">密 碼:</div></td>   
<td width="15%"><input name="PassWord" type="password"class="input_zc" id="PassWord" size="20" maxlength="20" /></td>   
<td width="9%"><input type="image" src="../images/login.gif" width="77" height="21" /></td>   
<td width="15%"><a href="../PersonInfor/PersonReg.html">個人註冊</a>  <a href="../CompanyInfor/CompanyReg.html">企業註冊</a></td> 
</tr> 
</form>
</table>
</body>

</html>

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.