<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!--
//var regexp =/^(\-|\+|[0-9])([0-9])*([0-9]|\.){0,1}([0-9])*$/; //数字,包括整数,小数,正负数
//var regexp = /^([\w\_\.])+@([\w]+\.)+([\w])+$/; //email地址
//var regexp = new RegExp("^[a-z]+@([a-z]+\.)+([a-z])+$","i");
//var regexp = /<(.*)>.*<\/\1>/
//var regexp=/^((([1-9]\d{0,1})|(1\d{2})|(2[0-4]\d)|(25[0-5]))\.){3}(([1-9]\d{0,1})|(1\d{2})|(2[0-4]\d)|(25[0-5]))$/;//IP Address,bug:172.0.0.2 can't be a valid IP address,modified by below
var regexp=/(^[0-9]{3,4}\-[0-9]{3,8}$)|(^[0-9]{3,8}$)|(^\([0-9]{3,4}\)[0-9]{3,8}$)|(^0{0,1}13[0-9]{9}$)/; //telephone NO. include mobile phone
//var regexp=/^((([1-9]\d{0,1})|(1\d{2})|(2[0-4]\d)|(25[0-4]))\.)((0|([1-9]\d{0,1})|(1\d{2})|(2[0-4]\d)|(25[0-5]))\.){2}(0|([1-9]\d{0,1})|(1\d{2})|(2[0-4]\d)|(25[0-5]))$/;//IP Address
var value=prompt("请输入一个数据","请在此输入");
if (value == "")
{
alert("The field is empty!");
}
if (!regexp.test(value))
{
alert("格式不对!!!");
}
else
{
alert("OK");
}
//-->
</SCRIPT>
</HEAD>
<BODY>
</BODY>
</HTML>