日期:2014-05-16 浏览次数:20456 次
var input = document.getElementsByName('weburl')[0],
submit_btn = document.getElementsByName('Submit2')[0];
submit_btn.disabled = "disabled";
input.onchange = function(){
if(this.value === "http://www.baidu.com/"){
submit_btn.disabled = true;
}
}
<!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></title>
<script type="text/javascript">
function Check() {
var str_url = document.getElementById("weburl").value;
var btn = document.getElementById("sss");
var strRegex = "^((https
------解决方案--------------------
http
------解决方案--------------------
ftp
------解决方案--------------------
rtsp
------解决方案--------------------
mms)?://)"
+ "?(([0-9a-z_!~*'().&=+$%-]+: )?[0-9a-z_!~*'().&=+$%-]+@)?" //ftp的user@
+ "(([0-9]{1,3}\.){3}[0-9]{1,3}" // IP形式的URL- 199.194.52.184
+ "
------解决方案--------------------
" // 允许IP和DOMAIN(域名)
+ "([0-9a-z_!~*'()-]+\.)*" // 域名- www.
+ "([0-9a-z][0-9a-z-]{0,61})?[0-9a-z]\." // 二级域名
+ "[a-z]{2,6})" // first level domain- .com or .museum
+ "(:[0-9]{1,4})?" // 端口- :80
+ "((/?)
------解决方案--------------------
" // a slash isn't required if there is no file name
+ "(/[0-9a-z_!~*'().;?:@&=+$,%#-]+)+/?)$";
var re = new RegExp(strRegex);
if (re.test(str_url)) {
alert("输入正确");
btn.disabled = false;