Web 开发常用手册JScript语言参考.rar http://download.csdn.net/source/308916DHTML参考手册.rar http://download.csdn.net/source/308913样式表中文手册.chm http://download.csdn.net/source/304124
function isFile(input, filter){ return new RegExp("^.+\.(?=EXT)(EXT)$".replace(/EXT/g, filter.split(/\s*、\s*/).join("|")), "gi").test(input); }测试: isFile(“nihao.jsp”,“.jsp、.php、.html、.asp”);
<!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>
<title> new document </title>
<meta name="generator" content="editplus" />
<meta name="author" content="" />
<meta name="keywords" content="" />
<meta name="description" content="" />
</head> <body>
<input type="text" value="" name="url" />
<script type="text/javascript">
<!--
document.getElementById("url").onchange = function() {
var sUrl = this.value;
var reg = /\.(jsp|php|html|asp)$/i;
if (reg.test(sUrl))
{
return true;
}
else
{
alert("请输入以 .jsp|.php|.html|.asp 结尾的地址!");
return false;
}
};
//-->
</script>
</body>
</html>
http://download.csdn.net/source/308916DHTML参考手册.rar
http://download.csdn.net/source/308913样式表中文手册.chm
http://download.csdn.net/source/304124
function isFile(input, filter){
return new RegExp("^.+\.(?=EXT)(EXT)$".replace(/EXT/g, filter.split(/\s*、\s*/).join("|")), "gi").test(input);
}测试:
isFile(“nihao.jsp”,“.jsp、.php、.html、.asp”);