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>  

 

相关文章:

  • 2021-12-14
  • 2021-11-22
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-07
猜你喜欢
  • 2021-11-30
  • 2021-12-14
  • 2021-08-24
  • 2021-12-25
  • 2021-07-30
  • 2021-11-22
  • 2021-11-22
相关资源
相似解决方案