手机
当前位置:查字典教程网 >编程开发 >Javascript教程 >jQuery实现自动输入email、时间和域名的方法
jQuery实现自动输入email、时间和域名的方法
摘要:本文实例讲述了jQuery实现自动输入email、时间和域名的方法。分享给大家供大家参考,具体如下:jQuery自动输入email、时间和域...

本文实例讲述了jQuery实现自动输入email、时间和域名的方法。分享给大家供大家参考,具体如下:

<!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>jQuery自动输入email、时间和域名</title> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/> <link rel="stylesheet" type="text/css" href="completer.css"/> <script src="jquery-1.10.1.min.js"></script> <script src="completer.min.js"></script> <script type="text/javascript"> $(function() { $("#auto-complete-email").completer({ separator: "@", source: ["163.com", "qq.com", "126.com", "139.com", "gmail.com", "hotmail.com", "icloud.com"] }); $("#auto-complete-time").completer({ filter: function(val) { val = val.replace(/D/g, "").substr(0, 2); if (val) { val = parseInt(val, 10) || 0; val = val > 23 ? 23 : val < 10 " + val : val; } return val; }, separator: ":", source: ["00", "05", "10", "15", "20", "25", "30", "35", "40", "45", "50", "55"] }); var $autoCompleteDomain = $("#auto-complete-domain"), $autoCompleteGo = $("#auto-complete-go"); $autoCompleteDomain.completer({ complete: function() { var url = "http://www." + $autoCompleteDomain.val(); $autoCompleteGo.attr("href", url); }, separator: ".", source: ["com", "net", "org", "co", "io", "me", "cn", "com.cn"] }); }); </script> </head> <body> <div> <div> <p>1、输入邮箱号:</p> <input type="text" id="auto-complete-email" placeholder="E-mail"/> <p></p> <p>2、输入时间:</p> <input type="text" id="auto-complete-time"/> <p></p> <p>3、输入域名:</p> <div> <span>www.</span> <input id="auto-complete-domain" type="text" placeholder="请输入域名" autocomplete="off" /> <span> <a id="auto-complete-go" href="javascript:void(0);">Go!</a> </span> </div> </div> </div> </body> </html>

运行效果图如下:

jQuery实现自动输入email、时间和域名的方法1

希望本文所述对大家jQuery程序设计有所帮助。

【jQuery实现自动输入email、时间和域名的方法】相关文章:

Javascript实现每日自动换一张图片的方法

jQuery仿gmail实现fixed布局的方法

jquery实现图片左右切换的方法

JQuery勾选指定name的复选框集合并显示的方法

jQuery实现在列表的首行添加数据

js实现一个链接打开两个链接地址的方法

javascript实现图片跟随鼠标移动效果的方法

javascript实现table表格隔行变色的方法

Jquery实现动态切换图片的方法

jQuery实现dialog设置focus焦点的方法

精品推荐
分类导航