用JS实现的radio图片选择按钮效果
2013-10-14 06:37:32 -0400
<style> .lanrentuku img{border:1px solid #008800;} </style> </head> <body> <script> function myFun(sId) { var oImg = document.getElementsByTagName('img'); for (var i = 0; i < oImg.length; i++) { if (oImg[i].id == sId) { oImg[i].previousSibling.previousSibling.checked = true; oImg[i].style.border = '1px solid #FF6600'; } else { oImg[i].style.border = '1px solid #008800'; } } } </script> <div class="lanrentuku"> <input type="radio" value= "lanrentuku" id= "111" name="aaa" style="display:none"> <img id="aa" src="http://www.lanrentuku.com/down/js/images/12625207690.gif " onclick="myFun(this.id)"> <input type="radio" value= "lanrentuku" id= "222" name="aaa" style="display:none"> <img id="bb" src="http://www.lanrentuku.com/down/js/images/12625207691.gif" onclick="myFun(this.id)"> <input type="radio" value= "lanrentuku" id= "333" name="aaa" style="display:none"> <img id="cc" src="http://www.lanrentuku.com/down/js/images/12625207692.gif" onclick="myFun(this.id)"> </div> <p>用JS实现的radio图片选择按钮效果。</p> <p>注意:input后面的空格。</p> <p>作者:<a href="http://www.lanrentuku.com/blog/" target="_blank">西西</a> 尊重他人劳动,转载请保留出处!</p> <p>演示:<a href="http://www.maitianquan.com/plus/guestbook.php" target="_blank">麦田圈</a></p> <p>查找更多代码,请访问:<a href="http://www.lanrentuku.com/" target="_blank">懒人图库</a></p> </body>
代码演示
用JS实现的radio图片选择按钮效果。
注意:input后面的空格。
作者:
西西
尊重他人劳动,转载请保留出处!
演示:
麦田圈
«Newer
Older»
Comment:
Name:
Back to home
Subscribe
|
Register
|
Login
|
N