js文件代码如下:<script type="text/javascript">
var email;
var bemail="0"; // boolean value to check correctness
... ... // other parametersfunction chkEmail(email){ // use AJax for dynamic checking
this.email=email;
var xmlhttp;
if (window.XMLHttpRequest) {
xmlhttp=new XMLHttpRequest();
}
else {
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4 && xmlhttp.status==200) {
document.getElementById("email").innerHTML=xmlhttp.responseText;
}
}
if (/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/.test(this.email)){ // regular expression checking
bemail="1"; // to tell the web page the input is in right format
xmlhttp.open("GET","chkemail.jsp?email="+email,true); xmlhttp.send();
}
else{
bemail="0"; // to tell the web page the input is in wrong format
xmlhttp.open("GET","chkemail.html",true); xmlhttp.send();
}
}
</script>js文件与html文件放在同一文件夹中,html中部分代码如下:<head>
... ...
<script type="txt/javascript" src="PrivateRegistration.js"></script>
</head><body>
... ...
<form name="form1" onSubmit="return chkform();" method="post" action="connectDataBase.jsp">
<table width="600" cellpadding="2" cellspacing="2" align="center" style="margin-left:60px">
<tr>
<td width="130"><span class="style1">* </span>Email</td>
<td><input size=40 name="txtEmail" type="text" onKeyUp="chkEmail(this.value)" onBlur="chkEmail(this.value)"></td>
<td><div id="email"></div></td>
</tr>
... ...
<body>现在js文件报错(dreamweaver cs5报错),没有任何提示。
只晓得是
this.email=email;
这一行有问题(第一个function中的第一行),删掉之后又跳到下一行,删掉这个function之后跳到下一个function的第一行,如此循环
这样写有什么不对么?请各路大牛指教。
var email;
var bemail="0"; // boolean value to check correctness
... ... // other parametersfunction chkEmail(email){ // use AJax for dynamic checking
this.email=email;
var xmlhttp;
if (window.XMLHttpRequest) {
xmlhttp=new XMLHttpRequest();
}
else {
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4 && xmlhttp.status==200) {
document.getElementById("email").innerHTML=xmlhttp.responseText;
}
}
if (/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/.test(this.email)){ // regular expression checking
bemail="1"; // to tell the web page the input is in right format
xmlhttp.open("GET","chkemail.jsp?email="+email,true); xmlhttp.send();
}
else{
bemail="0"; // to tell the web page the input is in wrong format
xmlhttp.open("GET","chkemail.html",true); xmlhttp.send();
}
}
</script>js文件与html文件放在同一文件夹中,html中部分代码如下:<head>
... ...
<script type="txt/javascript" src="PrivateRegistration.js"></script>
</head><body>
... ...
<form name="form1" onSubmit="return chkform();" method="post" action="connectDataBase.jsp">
<table width="600" cellpadding="2" cellspacing="2" align="center" style="margin-left:60px">
<tr>
<td width="130"><span class="style1">* </span>Email</td>
<td><input size=40 name="txtEmail" type="text" onKeyUp="chkEmail(this.value)" onBlur="chkEmail(this.value)"></td>
<td><div id="email"></div></td>
</tr>
... ...
<body>现在js文件报错(dreamweaver cs5报错),没有任何提示。
只晓得是
this.email=email;
这一行有问题(第一个function中的第一行),删掉之后又跳到下一行,删掉这个function之后跳到下一个function的第一行,如此循环
这样写有什么不对么?请各路大牛指教。
解决方案 »
- easyui window 以及 dialog 打开一个子页如何关闭 求解
- js获取table当前行号的顺序
- 求助,时间无法刷新
- 如何让IE不屏蔽JAVASCRIPT、ActiveX和弹出对话框(不通过IE设置,完全用程序完成,非恶意,只是工作需要)
- 有关数组赋值的问题
- 奇怪的问题,点击相应链接为什么不弹出对应的链接地址?
- 如何调用主页index.asp的的复选按钮的值进行判断呀
- jPages.js在jquery交出$后提示出错
- 如何让一个下拉框不能选择,就象文本设为readonly一样
- 怎样才能使select中的option掉换顺序?在线等待,马上揭贴。
- Jquery-easyUI treegrid 异步加载问题
- struts2中js中的值如何传给action急!!
<script type="text/javascript">
var email;
var bemail="0"; // boolean value to check correctness
... ... // other parametersfunction chkEmail(email){ // use AJax for dynamic checking
this.email=email;
var xmlhttp;
if (window.XMLHttpRequest) {
xmlhttp=new XMLHttpRequest();
}
else {
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4 && xmlhttp.status==200) {
document.getElementById("email").innerHTML=xmlhttp.responseText;
}
}
if (/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/.test(this.email)){ // regular expression checking
bemail="1"; // to tell the web page the input is in right format
xmlhttp.open("GET","chkemail.jsp?email="+email,true); xmlhttp.send();
}
else{
bemail="0"; // to tell the web page the input is in wrong format
xmlhttp.open("GET","chkemail.html",true); xmlhttp.send();
}
}
</script>js文件与html文件放在同一文件夹中,html中部分代码如下:<head>
... ...
<script type="txt/javascript" src="PrivateRegistration.js"></script>
</head><body>
... ...
<form name="form1" onSubmit="return chkform();" method="post" action="connectDataBase.jsp">
<table width="600" cellpadding="2" cellspacing="2" align="center" style="margin-left:60px">
<tr>
<td width="130"><span class="style1">* </span>Email</td>
<td><input size=40 name="txtEmail" type="text" onKeyUp="chkEmail(this.value)" onBlur="chkEmail(this.value)"></td>
<td><div id="email"></div></td>
</tr>
... ...
<body>
->
<script type="text/javascript" src="PrivateRegistration.js"></script>
没问题,以前js放在html里面没有独立出来的时候一切都可以运行,没有任何问题,所以jsp这边是没错的。
同时也感谢t5500的热心帮忙!