jQuery實現(xiàn)的漂亮表單效果代碼
本文實例講述了jQuery實現(xiàn)的漂亮表單效果代碼。分享給大家供大家參考。具體如下:
這是一款基于jQuery的漂亮的表單效果,將表單的輸入框換成了橫線,加入了背景,引入了jQuery插件,樣式上特別漂亮,是一個值得借鑒的jQuery表單美化實例,而且本表單在布局上完全是基于純CSS標簽來實現(xiàn),使用了CSS中的fieldset來制作表單,兼容性好。
運行效果如下圖所示:
在線演示地址如下:
http://demo.jb51.net/js/2015/jquery-table-input-style-codes/
具體代碼如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>noteform</title> <script src="jquery-1.6.2.min.js"></script> <script> $(function(){ $("div").click(function(){ $(this).addClass("select"); }); }) </script> <style> <!-- body{ background-image:url(wood-bg2.jpg); } .exlist{ background-color:#F9EE70; margin:30px auto; padding:5px; width:680px; min-height:200px; height:auto; font-family:"微軟雅黑"; -webkit-box-shadow:4px 4px 5px #333;/*webkit*/ -moz-box-shadow:4px 4px 5px #333;/*firefox*/ box-shadow:4px 4px 5px #333;/*opera或ie9*/ } #title{ width:200px; margin:20px auto; } #title legend{ font-size:26px; } div.exlist_title{ background-color:#F9EE70; width:680px; height:20px; } div.exlist_title img{ float:right; margin:-15px 10px; } /*-----------form-----------*/ fieldset{ width:90%; border:1px dashed #666; margin:40px auto; } legend{ background-color:#F9EE70; height:120px; height:30px; color:#630; font-weight:bolder; font-size:20px; line-height:30px; margin:-20px 10px 10px; padding:0 10px; } div.row{ margin:10px; padding:5px; } div.row label{ height:20px; font-size:16px; line-height:20px; margin:0 10px; } input.txt{ background-color:#F9EE70; color:#333; width:150px; height:20px; margin:0 10px; font-size:16px; line-height:20px; border:none; border-bottom:1px solid #565656; } input.txt:focus{ color:#333; background-color: #FF0; border-bottom:1px solid #F00; } select{ width:100px; } option{ text-align:center; } input.btn{ width:50px; height:20px; color:#000008B; background-color: transparent; border:0; padding:0; } --> </style> </head> <body> <div class="exlist"> <div class="exlist_title"></div> <div id="title"><legend>快遞運單信息</legend></div> <form method="post" action=""> <fieldset> <legend>收件信息</legend> <div class="row"> <label>1. 收貨人:</label> <input style="width:100px" class="txt" type="text" /> <label>2. 目的地:</label> <select> <option>北京</option> <option>上海</option> <option>武漢</option> <option>烏魯木齊</option> </select> </div> <div class="row"> <label>3. 聯(lián)系電話:</label><input class="txt" type="text" /> </div> <div class="row"> <label>4. 詳細地址:</label><input class="txt" style="width:400px" type="text" /> </div> </fieldset> <fieldset> <legend>發(fā)件信息</legend> <div class="row"> <label>1. 發(fā)貨人:</label> <input style="width:100px" class="txt" type="text" /> <label>2. 始發(fā)地:</label> <select> <option>北京</option> <option>上海</option> <option>武漢</option> <option>烏魯木齊</option> </select> </div> <div class="row"> <label>3. 聯(lián)系電話:</label><input class="txt" type="text" /> </div> <div class="row"> <label>4. 詳細地址:</label><input class="txt" style="width:400px" type="text" /> </div> </fieldset> <fieldset> <legend>貨物信息</legend> <div class="row"> <label>1. 數(shù)量:</label><input class="txt" style="width:30px" maxlength="2" type="text" /> <label>(1-99件)</label> <label>2. 體積:</label><input class="txt" style="width:30px" maxlength="3" type="text" /> <label>3. 重量:</label><input class="txt" style="width:30px" maxlength="3" type="text" /> <label>(Kg)</label> </div> <div class="row"> <label>4. 運輸方式:</label> <select> <option>航運</option> <option>火車</option> <option>汽車</option> <option>輪船</option> </select> </div> <div class="row"> <label>5. 付款方式:</label> <p> <label><input type="radio" name="pay" value="單選"/>現(xiàn)金付款</label> <label><input type="radio" name="pay" value="單選"/>收件人付款</label> <label><input type="radio" name="pay" value="單選"/>第三方付款</label> </p> </div> </fieldset> </form> </div> </body> </html>
希望本文所述對大家的jquery程序設(shè)計有所幫助。
相關(guān)文章
基于JQuery的訪問WebService的代碼(可訪問Java[Xfire])
最近有些時間學(xué)習(xí)了下JQuery,發(fā)現(xiàn)有很多JQuery訪問.net WebService的例子。作為WebService這種接口應(yīng)該是通用的,為什么沒人關(guān)于Java的例子呢?這點引起我的興趣。2010-11-11在jquery中的ajax方法怎樣通過JSONP進行遠程調(diào)用
這一節(jié)主要演示下在JQUERY中的ajax方法怎樣通過JSONP進行遠程調(diào)用,需要的朋友可以參考下2014-04-04JQuery 綁定select標簽的onchange事件,彈出選擇的值,并實現(xiàn)跳轉(zhuǎn)、傳參
JQuery 綁定select標簽的onchange事件,彈出選擇的值,并實現(xiàn)跳轉(zhuǎn)、傳參(selected的值和頁面其它元素的值)2011-01-01JQuery事件委托(適用于給動態(tài)生成的腳本元素添加事件)
jq寫了點擊事件,是通過獲取元素的類名被點擊后執(zhí)行對應(yīng)方法,但是研發(fā)套完模板,他會把所有的結(jié)構(gòu)先清空,導(dǎo)致jq根本找不到那個元素,所以事件就不得執(zhí)行了,需要的朋友可以參考下2020-02-02jQuery實現(xiàn)鼠標劃過添加和刪除class的方法
這篇文章主要介紹了jQuery實現(xiàn)鼠標劃過添加和刪除class的方法,涉及jQuery鼠標事件及頁面樣式的相關(guān)操作技巧,需要的朋友可以參考下2015-06-06Easyui和zTree兩種方式分別實現(xiàn)樹形下拉框
最近工作中需要用到樹形下拉框,因為項目中樹形結(jié)構(gòu)使用的是zTree,效果不是很好看,于是想著使用easyui的comboTree,雖然效果達到了,但是風(fēng)格和bootstrap不搭,下面把這兩種方式的效果分享到腳本之家平臺供大家參考2017-08-08