标题:[求助]javascript登陆问题
只看楼主
lanya1983
Rank: 1
等 级:新手上路
帖 子:96
专家分:0
注 册:2006-3-11
 问题点数:0 回复次数:3 
[求助]javascript登陆问题

javascript登陆问题,结果 java不劳动,直接点 登陆 就上去了
帮看看

<form method="post" name="frmlogin" action="verifyid.asp"
onsubmit="javascript:return validatelogin();">
<table align="center" bgcolot="#cccccc" border="0"
cellpadding="0" cellspacing="0" width="273">
<tr>
<td align="right" height="47" valign="bottom" width="94">用户名:
</td>
<td height="47" valign="bottom" width="172">
<input name="txtusername" size="15" maxlength="15">
</td>
</tr>
<tr>
<td align="right" width="94">密码:
</td>
<td width="172">
<input name="txtpassword" type="password" value size="15" maxlength="15">
</td>
</tr>
<tr>
<td align="right" height="44" width="94">
</td>
<td height="44" width="172">
<input name="submit" type="submit" value="提交">
&nbsp;&nbsp;&nbsp;
<input name="reset" type="reset" value="重置">
</td>
</tr>
</table>
</form>

<script language="javascript">
<!--
function validatelogin()
{var strusername=document.frmlogin.txtusername.value;
var strpassword=document.frmlogin.txtpassword.value;
var primeinusername=document.frmlogin.txtusername.value.indexof("'");
var priminpassword=document.frmlogin.txtpassword.value.indexof("'");
if(strusername=="")
{alert("输入用户名");
return false;
}
if(strpassword=="")
{alert("输入密码");
return false;
}
if(primeinusername!=-1)
{alert("密码中不能有撇号!");
return false;
}
if(primeinpassword!=-1)
{alert("用户名中不能包含撇号!")
return false;
}
}
//-->
</script>

搜索更多相关主题的帖子: javascript 登陆 
2006-04-27 20:22
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
得分:0 
回复:(lanya1983)[求助]javascript登陆问题

<script language="javascript">
<!--
function validatelogin()
{var strusername=document.frmlogin.txtusername.value;
var strpassword=document.frmlogin.txtpassword.value;
var primeinusername=document.frmlogin.txtusername.value;
var priminpassword;
priminpassword=document.frmlogin.txtpassword.value;
if(strusername=="")
{alert("输入用户名");
return false;
}
if(strpassword=="")
{alert("输入密码");
return false;
}
if(primeinusername.substr("'")!="")
{alert("用户名中不能包含撇号!");
return false;
}
if(primeinpassword.substr("'")!="")
{alert("密码中不能有撇号!");
return false;
}
document.frmlogin.submit();
}
//-->
</script>
<form method="post" name="frmlogin" action="verifyid.asp"
onsubmit="javascript:return validatelogin();">
<table align="center" bgcolot="#cccccc" border="0"
cellpadding="0" cellspacing="0" width="273">
<tr>
<td align="right" height="47" valign="bottom" width="94">用户名:
</td>
<td height="47" valign="bottom" width="172">
<input name="txtusername" size="15" maxlength="15">
</td>
</tr>
<tr>
<td align="right" width="94">密码:
</td>
<td width="172">
<input name="txtpassword" type="password" value size="15" maxlength="15">
</td>
</tr>
<tr>
<td align="right" height="44" width="94">
</td>
<td height="44" width="172">
<input name="button" type="button" value="提交" onClick="validatelogin();">
&nbsp;&nbsp;&nbsp;
<input name="reset" type="reset" value="重置">
</td>
</tr>
</table>
</form>

[此贴子已经被作者于2006-4-27 22:10:59编辑过]

2006-04-27 22:01
icecool
Rank: 9Rank: 9Rank: 9
等 级:贵宾
威 望:20
帖 子:1214
专家分:1366
注 册:2005-3-14
得分:0 

[CODE]

<script Language="JavaScript">
function form_check(){
var aa=document.form1.a1.value.length;
if(aa==0)
{window.alert("用户不能空");document.form1.a1.focus();return (false);}

var bb=document.form1.b1.value.length;
if(bb==0)
{window.alert("密码不能空");document.form1.b1.focus();return (false);}

}
</script>

<form name=form1 method=post onsubmit="return form_check()">
用户:<input type=text name=a1 id=a1 size=10><br>
密码:<input type=text name=b1 id=b1 size=10><br>

<input type=submit value=asdf>
</form>

[/CODE]


http://toorup.3v.do
loading...
2006-04-27 22:10
icecool
Rank: 9Rank: 9Rank: 9
等 级:贵宾
威 望:20
帖 子:1214
专家分:1366
注 册:2005-3-14
得分:0 

没贴过代码,原来是这样啊,好爽


http://toorup.3v.do
loading...
2006-04-27 22:11



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-60679-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 1.260570 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved