js实现两个radio的联动

来源:互联网 发布:sql数据库恢复工具 编辑:程序博客网 时间:2024/05/16 10:01
<script type="text/javascript"><!--google_ad_client = "pub-4490194096475053";/* 内容页,300x250,第一屏 */google_ad_slot = "3685991503";google_ad_width = 300;google_ad_height = 250;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
  2. <html xmlns="http://www.w3.org/1999/xhtml"> 
  3. <head> 
  4. <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> 
  5. <title>新建网页 1</title> 
  6. </head> 
  7. <body> 
  8. <script> 
  9. function checkradio(o,x){ 
  10. document.getElementsByName("inptB")[x-1].checked=o.checked 
  11. </script> 
  12. <input name="inptA" type="radio" id="inptA" onclick="checkradio(this,1)">aaa 
  13. <input name="inptA" type="radio" id="inptA" onclick="checkradio(this,2)">bbb 
  14. <input name="inptA" type="radio" id="inptA" onclick="checkradio(this,3)">ccc 
  15. <br> 
  16. <input name="inptB" type="radio" id="inptB">111 
  17. <input name="inptB" type="radio" id="inptB">222 
  18. <input name="inptB" type="radio" id="inptB">333 
  19. </body> 
  20. </html> 
<script type="text/javascript"><!--google_ad_client = "pub-4490194096475053";/* 728x90, 创建于 08-12-8 */google_ad_slot = "0403648181";google_ad_width = 728;google_ad_height = 90;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
原创粉丝点击