如何判断同名复选框是否有被选中,
问题1
我用了一组同名的复选框,当复选框一个也没有被选中时,弹出警告框
<script language= "javascript ">
function submitchecken() {
if (document.checkdomain.Cp_DnsName.value == " ") {
alert( "请至少选择一个域名后缀 ");
document.checkdomain.Cp_DnsName.focus();
return false;
}
return true;
}
</script>
<form method= "post " action= "ke.asp " name= "checkdomain " onsubmit= "return submitchecken(); ">
<table width= "180 " border= "0 " cellpadding= "0 " cellspacing= "0 ">
<tr>
<td align= "left "> <input name= "Cp_DnsName " type= "checkbox " value= ".com " checked= "checked " /> </td>
<td align= "left "> .com </td>
<td align= "left "> <input name= "Cp_DnsName " type= "checkbox " value= ".net " /> </td>
<td align= "left "> .net </td>
<td align= "left "> <input name= "Cp_DnsName " type= "checkbox " value= ".org " /> </td>
<td align= "left "> .org </td>
</tr>
<tr> <td> <input type= "submit " name= "Submit " value= "查询 "> </td> </tr>
</table>
</form>
问题2
因本人分数数不够,只好多问个问题(希望大家不要打我)
怎样判断字符是否都为简体中文
------解决方案--------------------question 1:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN ">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME= "Generator " CONTENT= "EditPlus ">
<META NAME= "Author " CONTENT= " ">
<META NAME= "Keywords " CONTENT= " ">
<META NAME= "Description " CONTENT= " ">
</HEAD>
<BODY>
<script language= "javascript ">
function submitchecken() {
for(var i=0;i <document.checkdomain.Cp_DnsName.length;i++){
if (document.checkdomain.Cp_DnsName[i].checked) {
return true;
}
}
alert( "请至少选择一个域名后缀 ");
//document.checkdomain.Cp_DnsName.focus(); 不支持focus的
return false;
}
</script>
<form method= "post " action= "ke.asp " name= "