console
$(document).ready(function(){
$("#flip").click(function(){
$("#panel").slideToggle("slow");
});
});
$(document).ready(function(){
$("button").click(function(){
$("p").hide("slow",function(){
alert("段落现在被隐藏了");
});
});
});
$(document).ready(function(){
$("button").click(function(){
$("#h").offsetParent().css("background-color","red");
});
});
<body>
<h1>登录爱奇艺,悦享品质生活</h1>
<p></p>
</body>
<center>
<title>Untitled Document</title>
<script language="javascript">
function checkname(){
var div = document.getElementById("div1");
div.innerHTML = "";
var name1 = document.form1.text1.value;
if (name1 == "") {
div.innerHTML = "姓名不能为空!";
document.form1.text1.focus();
return false;
}
if (name1.length < 4 || name1.length > 16) {
div.innerHTML = "姓名输入的长度4-16个字符!";
document.form1.text1.select();
return false;
}
var charname1 = name1.toLowerCase();
for (var i = 0; i < name1.length; i++) {
var charname = charname1.charAt(i);
if (!(charname >= 0 && charname <= 9) && (!(charname >= 'a' && charname <= 'z')) && (charname != '_')) {
div.innerHTML = "姓名包含非法字母,只能包含字母,数字,和下划线";
document.form1.text1.select();
return false;
}
}
return true;
}
function checkpassword(){
var div = document.getElementById("div2");
div.innerHTML = "";
var password = document.form1.text2.value;
if (password == "") {
div.innerHTML = "密码不位空!";
document.form1.text2.focus();
return false;
}
if (password.length < 4 || password.length > 12) {
div.innerHTML = "密码长度4-12位";
document.form1.text2.select();
return false;
}
return true;
}
function checkrepassword(){
var div = document.getElementById("div3");
div.innerHTML = "";
var password = document.form1.text2.value;
var repass = document.form1.text3.value;
if (repass == "") {
div.innerHTML = "密码不位空!";
document.form1.text3.focus();
return false;
}
if (password != repass) {
div.innerHTML = "输入密码和确认密码长度不一致";
document.form1.text3.select();
return false;
}
return true;
}
function checkEmail(){
var div = document.getElementById("div4");
div.innerHTML = "";
var email = document.form1.text5.value;
var sw = email.indexOf("@", 0);
var sw1 = email.indexOf(".", 0);
var tt = sw1 - sw;
if (email.length == 0) {
div.innerHTML = "电子邮件不能位空";
document.form1.text5.focus();
return false;
}
if (email.indexOf("@", 0) == -1) {
div.innerHTML = "电子邮件格式不正确,必须包含@符号!";
document.form1.text5.select();
return false;
}
if (email.indexOf(".", 0) == -1) {
div.innerHTML = "电子邮件格式不正确,必须包含.符号!";
document.form1.text5.select();
return false;
}
if (tt == 1) {
div.innerHTML = "邮件格式不对。@和.不可以挨着!";
document.form1.text5.select();
return false;
}
if (sw > sw1) {
div.innerHTML = "电子邮件格式不正确,@符号必须在.之前";
document.form1.text5.select();
return false;
}
else {
return true;
}
return ture;
}
function check(){
if (checkname() && checkpassword() && checkrepassword() && checkEmail()) {
return true;
}
else {
return false;
}
}
</script>
<body>
<button id="h">设置背景颜色</button>
<div style="border:1px solid black;width:500px;hight:500px;position:absolute;left:30px;top:100px">
<div style="border:1px solid black;hight:500px;margin:50px;background-color:yellow">
<h>
<body>
<button id="p">隐藏</button>
<p>
<body>
<form name="form1" method="post" action="2.html" onsubmit="return check()">
<table>
<tr>
<td>
用户名:
</td>
<td>
<input id="text1" type="text" name="text1" onblur="check()">
<div id="div1" style="display:inline">
</div>
</td>
</tr>
<tr>
<td>
手机:
</td>
<td>
<input id="text1" type="text" name="text1" onblur="check()">
<div id="div1" style="display:inline">
</div>
</td>
</tr>
<tr>
<td>
密码:
</td>
<td>
<input id="text2" type="password" name="text2" onblur="check()">
<div id="div2" style="display:inline">
</div>
</td>
</tr>
<tr>
<td>
确认密码:
</td>
<td>
<input id="text3" type="password" name="text3" onblur="check()">
<div id="div3" style="display:inline">
</div>
</td>
</tr>
<tr>
<td>
验证码:
</td>
<td>
<input id="text1" type="text" name="text1" onblur="check()">
<div id="div1" style="display:inline">
</div>
</td>
</tr>
<tr>
<td>
电子邮件地址:
</td>
<td>
<input id="text4" type="text" name="text4" onblur="check()">
<div id="div4" style="display:inline">
</div>
</td>
</tr>
<tr align="center">
<td align="center">
<input type="checkbox" name="vehicle" value="Car">我同意《用户服务协议》
<p><a href="http://passport.pps.tv/pages/user/login.action?btnId=userhome&url=http%3A%2F%2Fup.ipd.pps.tv%2Fupload%3Ftype%3D0%26ufrm%3Dweb_iqiyi_uc">立即登录</a></p>
<input type="submit" value="注册" name="tect6"><input type="reset" value="取消" name="text7">
<script src="http://cdn.static.runoob.com/libs/jquery/1.10.2/jquery.min.js">
</script>
<div id="flip">使用其他方式登录</div>
<div id="panel">
<div> 短信登录</div>
<div>手机扫码登录</div>
</div>
<p>^</p>
</td>
</tr>
</table>
</form>
</body>
</h>
</body>
</body>
</center>
body
{
background-image:url("http://pic34.photophoto.cn/20150318/0017030532235937_b.jpg");
background-color:#cccccc;
background-size:cover;
background-repeat:no-repeat;
}
#panel,#flip
{
padding:5px;
text-align:center;
background-color:#e5eecc;
border:solid 1px #c3c3c3;
}
#panel
{
padding:50px;
display:none;
}