JS實(shí)現(xiàn)表單中checkbox對(duì)勾選中增加邊框顯示效果
本文實(shí)例講述了JS實(shí)現(xiàn)表單中checkbox對(duì)勾選中增加邊框顯示效果。分享給大家供大家參考。具體如下:
這里用JavaScript實(shí)現(xiàn)checkbox復(fù)選框選中效果,表單中的復(fù)選框效果,打?qū)催x中效果模擬,JS與HTML5相結(jié)合實(shí)現(xiàn)的美化效果。貌似目前比較流行的效果啦!
運(yùn)行效果截圖如下:
在線演示地址如下:
http://demo.jb51.net/js/2015/js-table-checkbox-check-border-show-codes/
具體代碼如下:
<!doctype html> <html lang="en-US"> <head> <meta http-equiv="Content-Type" content="text/html; chaRset=gb2312" /> <title>JS實(shí)現(xiàn)單個(gè)圖片選中美化框</title> <style type="text/css"> body, div, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6, pre, code, form, fieldset, legend, input, button, textarea, blockquote, th, td, p { margin:0; padding:0 } input, button, select, textarea { outline:none } li { list-style:none } img { vertical-align:top; border:none } textarea { resize:none } body { width:auto; height:auto; padding:0; margin:0; color: #666; background: #FFF; } body, input, textarea { font-size:12px; font-family:Arial, Verdana, "Microsoft Yahei", Simsun } a{cursor:pointer} a:link{color:#37a;text-decoration:none} a:visited{color:#669;text-decoration:none} a:hover{color:#fff;text-decoration:none;background:#37a} a:active{color:#fff;text-decoration:none;background:#f93} .clear { clear:both } .clearfix:after{ content:"."; display:block; font-size: 0; height:0; clear:both; visibility:hidden } .clearfix{ zoom:1} #radio_wrap{width: 916px; margin: 50px auto 0;font-size: 0;*word-spacing:-1px;} @media screen and (-webkit-min-device-pixel-ratio:0){ #radio_wrap{letter-spacing:-4px;}} #radio_wrap input{display: none;} #radio_wrap li{position:relative; width: 223px; height: 259px; border: 1px solid #CCC; display:inline-block; *display:inline; *zoom:1; margin:0 2px;} #radio_wrap li.checked{border:2px solid red;margin:-1px 1px;} #radio_wrap li.checked i{width:30px; height:30px; position:absolute; right:0; bottom:0;_right:-1px; _bottom:-1px;background:url(images/checked.gif) no-repeat;} </style> </head> <body> <div id="radio_wrap"> <ul> <li class="c checked"> <input type="radio" id="radio_a_01" name="radio_a" /> <label for="radio_a_01"><img src="images/taobao2.jpg" alt="" disabled/></label> <i></i> </li> <li class="c"> <input type="radio" id="radio_a_02" name="radio_a" /> <label for="radio_a_02"><img src="images/taobao2.jpg" alt="" disabled/></label> <i></i> </li> </ul> </div> <script type="text/javascript"> (function() { var radioWrap = document.getElementById("radio_wrap"), li = radioWrap.getElementsByTagName("li"); for(var i = 0; i < li.length; i++){ li[i].onclick = function() { for(var i = 0; i < li.length; i++){ li[i].className = ""; } this.className = "checked"; } } })(); </script> <div style="text-align:center;clear:both"><br> </div> </body> </html>
希望本文所述對(duì)大家的javascript程序設(shè)計(jì)有所幫助。
- javascript鼠標(biāo)滑過(guò)顯示二級(jí)菜單特效
- JS實(shí)現(xiàn)鼠標(biāo)滑過(guò)鏈接改變網(wǎng)頁(yè)背景顏色的方法
- JS實(shí)現(xiàn)鼠標(biāo)滑過(guò)折疊與展開菜單效果代碼
- JavaScript實(shí)現(xiàn)鼠標(biāo)滑過(guò)圖片變換效果的方法
- js鼠標(biāo)滑過(guò)圖片震動(dòng)特效的方法
- 當(dāng)鼠標(biāo)滑過(guò)文本框自動(dòng)選中輸入框內(nèi)容的JS代碼分享
- JS鼠標(biāo)滑過(guò)圖片時(shí)切換圖片實(shí)現(xiàn)思路
- js鼠標(biāo)滑過(guò)彈出層的定位IE6bug解決辦法
- jsp中使用frameset框架 邊框固定不讓更改邊框的大小
- JS實(shí)現(xiàn)鼠標(biāo)滑過(guò)顯示邊框的菜單效果
相關(guān)文章
js 實(shí)現(xiàn)省市區(qū)三級(jí)聯(lián)動(dòng)菜單效果
本文主要分享了js實(shí)現(xiàn)省市區(qū)三級(jí)聯(lián)動(dòng)菜單效果的示例代碼。具有很好的參考價(jià)值,下面跟著小編一起來(lái)看下吧2017-02-02layui 地區(qū)三級(jí)聯(lián)動(dòng) form select 渲染的實(shí)例
今天小編就為大家分享一篇layui 地區(qū)三級(jí)聯(lián)動(dòng) form select 渲染的實(shí)例,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧2019-09-09Javascript中Null和undefined的簡(jiǎn)單理解
在JavaScript中存在這樣兩種原始類型:Null與Undefined,這兩種類型常常會(huì)使JavaScript的開發(fā)人員產(chǎn)生疑惑,在什么時(shí)候是Null,什么時(shí)候又是Undefined,下面這篇文章主要給大家介紹了關(guān)于Javascript中Null和undefined的相關(guān)資料,需要的朋友可以參考下2022-04-04js select實(shí)現(xiàn)省市區(qū)聯(lián)動(dòng)選擇
這篇文章主要為大家詳細(xì)介紹了js select實(shí)現(xiàn)省市區(qū)聯(lián)動(dòng)選擇效果,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2016-08-08如何設(shè)置一定時(shí)間內(nèi)只能發(fā)送一次請(qǐng)求
這篇文章主要介紹了如何設(shè)置一定時(shí)間內(nèi)只能發(fā)送一次請(qǐng)求,需要的朋友可以參考下2014-02-02Bootstrap學(xué)習(xí)筆記之css樣式設(shè)計(jì)(1)
這篇文章主要為大家詳細(xì)介紹了bootstrap學(xué)習(xí)筆記之css樣式設(shè)計(jì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2016-06-06