87,910
社区成员
发帖
与我相关
我的任务
分享
<html>
<head>
<link rel="stylesheet" type="text/css" href="css/register.css" />
<script type="text/javascript" src="jquery.js"></script>
<!--script type="text/javascript" src="js/register.js"></script -->
<!--
-->
</head>
<body>
<div id="box">
<div id="logo">
<img src="image/logo.gif" width="128" height="128">
<p></p>
</div>
<div class="form">
<form action="register.php" method="get">
<!--自己写的注册框
<input type="text" class="input" value="your name" />
-->
<div>
<div><p><input class="input" type="text" name="username" value="用户名"/></p></div>
<div><p><input class="input" type="password" name="password" value="密码"/></p></div>
<div><p><input class="input" type="password" name="password" value="密码"/></p></div>
<div><p><input class="input" type="text" name="email" value="邮箱"/></p></div>
<div><input type="submit" value="注册" /></div>
</div>
</form>
</div>
</div>
</body>
<script type="text/javascript">
$(document).ready(function() {
//each遍历文本框
$(".input").each(function() {
//保存当前文本框的值
var vdefault = this.value;
$(this).focus(function() {
//获得焦点时,如果值为默认值,则设置为空
if (this.value == vdefault) {
this.value = "";
}
});
$(this).blur(function() {
//失去焦点时,如果值为空,则设置为默认值
if (this.value == "") {
this.value = vdefault;
}
});
});
});
</script>
</html>