留言板实例-验证ID和邮箱
来源:互联网 发布:曹县大集淘宝村 编辑:程序博客网 时间:2024/06/06 18:10
效果:
HTML部分:
<html><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"> <style type = "text/css"> @import"mystyle.css"</style><script src="index.js" type="text/javascript"></script></head><body><div class= "test-css"><form id = "form1" action="" method="post" class="STYLE-NAME" onsubmit = "return test()"><h1>留言板实例<span>填写下面的信息(*为必填).</span></h1><label><!-- <span id = "bt">*</span> --><span class = "c">ID :</span><input id="name" type="text" name="name" placeholder="填写你的ID" /></label><label><!-- <span id = "bt">*</span> --><span class = "c">Email :</span><input id="email" type="email" name="email" placeholder="请输入有效的Email地址" /></label><label><span>留言 :</span><textarea id="message" name="message" placeholder="请输入留言内容"></textarea></label><label><span>注册信息 :</span><select name="selection"><option value="Job Inquiry">已注册用户</option><option value="General Question">游客</option></select></label><label><span> </span><input type="button" class="button" value="确定" onclick= test() /></label></form></div></body></html>
JS部分:
function test(){e = email.value;// i = name.value;i = document.getElementById("name");if (i == ""){alert("ID不能为空!")}if (e == ""){alert("邮箱不能为空!");return false;}var reg = /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/;ok = reg.test(e);if (!ok){alert("邮箱格式不正确!");return false;}}
CSS部分:
.test-css {margin-left:auto;margin-right:auto;max-width: 500px;background: #F8F8F8;padding: 30px 30px 20px 30px;font: 12px Arial, Helvetica, sans-serif;color: #666;border-radius: 5px;-webkit-border-radius: 5px;-moz-border-radius: 5px;}.test-css h1{font: 24px "Trebuchet MS", Arial, Helvetica, sans-serif;padding: 20px 0px 20px 40px;display: block;margin: -30px -30px 10px -30px;color: #FFF;background: #9DC45F;text-shadow: 1px 1px 1px #949494;border-radius: 5px 5px 0px 0px;-webkit-border-radius: 5px 5px 0px 0px;-moz-border-radius: 5px 5px 0px 0px;border-bottom:1px solid #89AF4C;}.test-css h1>span {display: block;font-size: 11px;color: #FFF;}.test-css label {display: block;margin: 0px 0px 5px;}.test-css label>span {float: left;margin-top: 10px;color: #5E5E5E;}.c::before{ content : "*"; color : red; }.test-css input[type="text"], .test-css input[type="email"], .test-css textarea, .stest-css select {color: #555;height: 30px;line-height:15px;width: 100%;padding: 0px 0px 0px 10px;margin-top: 2px;border: 1px solid #E5E5E5;background: #FBFBFB;outline: 0;-webkit-box-shadow: inset 1px 1px 2px rgba(238, 238, 238, 0.2);box-shadow: inset 1px 1px 2px rgba(238, 238, 238, 0.2);font: normal 14px/14px Arial, Helvetica, sans-serif;}.test-css textarea{height:100px;padding-top: 10px;}.test-css select {background: no-repeat right, -moz-linear-gradient(top, #FBFBFB 0%, #E9E9E9 100%);background: no-repeat right, -webkit-gradient(linear, left top, left bottom, color-stop(0%,#FBFBFB), color-stop(100%,#E9E9E9));appearance:none;-webkit-appearance:none;-moz-appearance: none;text-indent: 0.01px;text-overflow: '';width:100%;height:30px;}.test-css.button {background-color: #9DC45F;border-radius: 5px;-webkit-border-radius: 5px;-moz-border-border-radius: 5px;border: none;padding: 10px 25px 10px 25px;color: #FFF;text-shadow: 1px 1px 1px #949494;}.smart-green .button:hover {background-color:#80A24A;}
1 0
- 留言板实例-验证ID和邮箱
- email邮箱登陆验证实例
- 邮箱和手机号码验证
- 邮箱和电话号码验证
- java实现邮箱验证QQ邮箱验证和Foxmail验证
- PHP简易表单验证与简易留言板实例
- Java乔晓松-ajax实现用户名和邮箱唯一验证实例(struts2框架和HIbernate)
- JS正则表单邮箱验证实例
- JS验证手机和邮箱
- android验证手机号码和邮箱
- OC--验证邮箱和电话号码
- JS验证邮箱和手机号
- 验证手机号 和 邮箱格式
- 验证邮箱和正则表达式
- 验证邮箱和正则表达式
- lua邮箱和手机号验证
- 邮箱和手机号粗略验证
- php中filter函数验证邮箱、url和ip地址的实例
- 每天一个Linux命令(44):iostat
- bzoj2431: [HAOI2009]逆序对数列
- Codeforces Round #408 (Div. 2)(A+B)模拟
- ruby 解决 php aes 与 ruby aes zero 算法不用的问题
- MySQ基本操作
- 留言板实例-验证ID和邮箱
- C++抽象编程——如何修改map中的值
- 图像技术分类一图通
- C语言中变量的存储方式
- IO 编程模型(java篇) 精华一页纸
- 用openssl实现DES和AES算法时遇到的小问题
- 线性回归(linear regression)
- 头疼的算法与数据结构——八皇后问题(递归法)
- json与Dictionary 传输对比