1 JS验证验证服务器控件
2
3 <script language="javascript" type="text/javascript">
4 /*****************************************************************/
5 /* 6 /* 用户信息验证
7 /* 2012--07--30
8 /*****************************************************************/
9 function checkinfo()
10 {
11 var TextBox1=document.getElementById('<%=TextBox1.ClientID %>').value;
12 if(TextBox1=="")
13 {
14 alert("用户名不能为空");
15 return false;
16 }
17 var TextBox2=document.getElementById('<%=TextBox2.ClientID %>').value;
18 if(TextBox2=="")
19 {
20 alert("用户密码不能为空");
21 return false;
22 }
23 var TextBox3=document.getElementById('<%=TextBox3.ClientID %>').value;
24 if(TextBox3=="")
25 {
26 alert("用户真实名称不能为空");
27 return false;
28 }
29 var Radio1=document.getElementById('<%=Radio1.ClientID %>');
30 var Radio2=document.getElementById('<%=Radio2.ClientID %>');
31 if(!Radio1.checked&&!Radio2.checked)
32 {
33 alert("用户状态没有选择");
34 return false;
35 }
36 var DropDownList1 = document.getElementById("DropDownList1.ClientID");
37 var index = DropDownList1.selectedIndex;
38 var Value = DropDownList1.options[index].value;
39 alert(Value);
40 //var Text = ddl.options[index].text;
41 if(Value=="-1")
42 {
43 alert("请选择地区");
44 return false;
45 }
46 else
47 {
48 return true;
49 }
50 }
51 </script>
52
53