单选按钮加confirm进行判断返回false任被选中问题

     <html>
<head> <script language="javascript">
var checkValue = "";
var radios = document.getElementsByName("test");
function nowChecked(){
for(var i=;i<radios.length;i++){
if(radios[i].checked){
checkValue = radios[i].value;
}
}
}
function change(n){ //alert("checkValue:"+checkValue+" n:"+n);
if(checkValue != n){ if(confirm("确认修改?")){
radios[n].checked =true;
nowChecked();
}else{
radios[checkValue].checked = true;
}
}
}
</script>
</head> <body onload="nowChecked()">
<input type="radio" name="test" value="" checked="checked" onclick="change(0)"/>是
<input type="radio" name="test" value="" onclick="change(1)"/>否
</body> </html>
上一篇:C# Lock锁(个人随记)


下一篇:java TCP并发实现文件上传---转载(PS:适合java1.6之前)