标签:http java 使用 javascript html cti
<!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>无标题文档</title>
<script type="text/javascript" language="javascript">
//验证邮箱
function checkEmail(){
var email = document.myform.txtEmail.value;
if(email.indexOf("@")<0){
alert("邮箱必须有@符号");
return false;
}else if(email.lastIndexOf(".")<0){
alert("邮箱必须有.符号");
return false;
}else if(email.indexOf("@")>email.lastIndexOf(".")){
alert("@符号一定要在最后一个.前面");
return false;
}
return true;
}
function clearEmail(){
document.myform.txtEmail.value = "";
}
//用代码提交表单
function formSubmit(){
if(checkEmail()){
document.myform.submit();//提交表单
}
}
</script>
</head>
<body>
<form action="http://www.baidu.com" method="get" name="myform">
您的电子邮箱:<input type="text" name="txtEmail" /><br />
<input value="清空" onclick="clearEmail();" type="button" />
<input type="button" onclick="formSubmit();" value="注册"/>
</form>
</body>
</html>
标签:http java 使用 javascript html cti
原文地址:http://www.cnblogs.com/danmao/p/3815838.html