<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="Jquery1.7.js" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
$('#txtemail').focus(function () {
$('#spemail').html('请输入邮箱地址');
})
$('#txtemail').blur(function () {
var txt = $(this).val();
if (txt.length == 0) {
$('#spemail').html('邮箱地址不能为空');
}
else {
if (chkemail(txt) == false) {
$('#spemail').html('邮箱格式不正确,请重新输入');
}
else {
var str = '<img src=images/onSuccess.gif>';
// $('#spemail').replaceWith();
$('#spemail').html(str);
}
}
})
function chkemail(stremail) {
if (!/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/.test(stremail)) {
return false;
}
else {
return true;
}
}
})
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<table>
<tr><td>输入邮箱:<input type="text" id="txtemail"/></td><td><span id="spemail"></span></td></tr>
<tr><td>确认邮箱:<input type="text" /></td><td></td></tr>
</table>
</div>
</form>
</body>
</html>