¼ò½é
jQuery cForm ÊÇÒ»¿î»ùÓÚ jQuery µÄ±íµ¥ÃÀ»¯²å¼þ£¬ËüÄܹ»ÃÀ»¯ÎÒÃdz£¼ûµÄ±íµ¥ÔªËØ£¬È磺Îı¾Óò£¨text/textarea£©¡¢ÃÜÂëÓò£¨password£©¡¢µ¥Ñ¡°´Å¥£¨radio£©¡¢¸´Ñ¡¿ò£¨checkbox£©¡¢ÏÂÀ¿ò£¨select£©¡¢ÎļþÉÏ´«£¨file£©¡¢°´Å¥£¨button/submit£©µÈµÈ¡£jQuery cForm ʹÓøɾ»µÄ HTML ºÍƯÁÁµÄ CSS Ìæ´ú¸÷ä¯ÀÀÆ÷Ô±¾²»Ì«ÃÀ¹ÛÇÒ²»Í³Ò»µÄ±íµ¥½øÐÐÃÀ»¯£¬Äã²»ÐèÒª¶ÔÔÓÐµÄ±íµ¥×öÈκÎÐ޸ģ¬Ö»ÐèÒª½«ÆäÒýÈ롢ʹÓü´¿É¡£
ä¯ÀÀÆ÷¼æÈÝ
IE9+ ✔ | Chrome ✔ | Firefox ✔ | Opera ✔ | Safari ✔ |
ʹÓ÷½·¨
1¡¢ÒýÈëÎļþ
<link rel="stylesheet" href="css/cform.style.css"> <script src="js/jquery.min.js"></script> <script src="js/jquery.cform.min.js"></script>
2¡¢HTML
<ul class="dowebok"> <li> <label class="label" for="username">Óû§Ãû£º</label> <input type="text" name="username" id="username"> </li> <li> <label class="label" for="password">ÃÜÂ룺</label> <input type="password" name="password" id="password"></li> <li> <span class="label">ÐÔ±ð£º</span> <input type="radio" name="sex" id="male" value="ÄÐ"> <label>ÄÐ</label> <input type="radio" name="sex" id="female" value="Å®"> <label>Å®</label> </li> <li> <label class="label" for="city">³ÇÊУº</label> <select name="city" id="city"> <option value="">Ñ¡Ôñ</option> <option value="±±¾©">±±¾©</option> <option value="ÉϺ£">ÉϺ£</option> <option value="¹ãÖÝ">¹ãÖÝ</option> <option value="ÉîÛÚ">ÉîÛÚ</option> </select> </li> ... <li><input class="send" type="submit" value="Ìá½»"></li> </ul>
3¡¢CSS
cform.style.css Ö»ÊÇ±íµ¥µÄÃÀ»¯Ñùʽ£¬Äã¿ÉÄÜ»¹ÐèÒª¸ù¾Ý×Ô¼ºµÄʵ¼ÊÇé¿ö¶îÍâÌí¼ÓһЩÑùʽ¡£
4¡¢JavaScript
$(function(){ $('.dowebok').cForm(); });
ÅäÖÃ
jQuery cForm ûÓÐÌṩֱ½ÓµÄÅäÖã¬Èç¹ûÐèÒªÐÞ¸ÄÑùʽ·ç¸ñ£¬Ö»ÐèÒªÐ޸Ļò¸²¸Ç cform.style.css ¼´¿É£¬jQuery cForm Éú³ÉµÄ¶ÔÓ¦±íµ¥´úÂëÈçÏ£º
1¡¢input type=”text”
<div class="cform-text"></div>
2¡¢input type=”password”
<div class="cform-text cform-password"></div>
3¡¢textarea
<div class="cform-text"></div>
4¡¢input type=”file”
<div class="cform-file" data-name="{{name}}"> <div class="cform-control">choose file</div> <div class="cform-filename">click here</div> </div>
5¡¢input type=”checkbox”
<div class="cform-checkbox" data-name="{{name}}" data-value="{{value}}"> <div class="cform-marker"></div> </div>
6¡¢input type=”radio”
<div class="cform-radio" data-name="{{name}}" data-value="{{value}}"> <div class="cform-marker"></div> </div>
7¡¢select
<div class="cform-select" data-name="{{name}}"> <div class="cform-control">{{text}}</div> <ul></ul> </div>
8¡¢select multiple
<div class="cform-multiselect" data-name="{{name}}"> <ul></ul> </div>
9¡¢select option
<li data-value="{{value}}">{{text}}</li>
10¡¢button
<div class="cform-button"></div>
11¡¢input type=”submit”
<div class="cform-submit"></div>
תÔØÇë×¢Ã÷£º ÎÄÕÂתÔØ×Ô£º°®Ë¼×ÊÔ´Íø http://www.aseoe.com/show-79-710-1.html