码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2017-01-06 21:52:01      阅读:166      评论:0      收藏:0      [点我收藏+]

标签:element   div   blog   conf   ios   bsp   i++   doc   问题   

 1     <html>  
 2         <head>  
 3           
 4         <script language="javascript">  
 5             var checkValue = "";  
 6             var radios = document.getElementsByName("test");  
 7             function nowChecked(){  
 8                 for(var i=0;i<radios.length;i++){  
 9                     if(radios[i].checked){  
10                         checkValue = radios[i].value;  
11                     }  
12                 }  
13             }  
14             function change(n){  
15                   
16                 //alert("checkValue:"+checkValue+"  n:"+n);  
17                 if(checkValue != n){  
18                   
19                     if(confirm("确认修改?")){  
20                         radios[n].checked =true;  
21                         nowChecked();  
22                     }else{  
23                         radios[checkValue].checked = true;  
24                     }  
25                 }  
26             }  
27         </script>  
28         </head>  
29           
30         <body onload="nowChecked()">  
31             <input type="radio" name="test" value="0" checked="checked" onclick="change(0)"/>32             <input type="radio" name="test" value="1" onclick="change(1)"/>33         </body>  
34       
35     </html>  

 

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

标签:element   div   blog   conf   ios   bsp   i++   doc   问题   

原文地址:http://www.cnblogs.com/licz/p/6257085.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!