function fn_Login_validate(){
var userName =document.getElementById("logName");
var pwd =document.getElementById("logPwd");
if(userName.value.Trim()==""){
ymPrompt.errorInfo({message:'操作失败:请填写用户名!',height:'150',title:'登陆错误提示'});
return false;
}
if(pwd.value.Trim()==""){
ymPrompt.errorInfo({message:'操作失败:请填写密码!',height:'150',title:'登陆错误提示'});
return false
}else{
//这里不写 直接执行登陆action
}
} 以上js 运行的时候在IE 搜狗 360 都运行没有问题。但是今天在火狐上运行的时候。 不提示任何错误。也不弹出对话框 直接就提交表单了。一下是表单部分。各位帮忙看看那个错误了。。 谢谢了。<form action="" method="post" onsubmit="return fn_Login_validate();">
<table width="230" height="75" border="0" cellpadding="0"
cellspacing="0">
<tr>
<td width="51"
style="font-size:12px; font-weight:600; color:#8D96AA">
用户名:
</td>
<td width="80">
<input type="text" name="logName"
style="width:69px; height:18px; border:1px solid #8D96AA;color:#666666;font-size: 12px;" />
</td>
<td width="99" align="left">
<font style="font-size:12px; font-weight:600;color:#E48A37;">
<input type="checkbox" value="1" name="saveCookis"
style="background:#AEC991; width:13px; height:13px;color:#666666;font-size: 12px;" />
记住</font>
<a href="#" title="注册新用户"
style="font-size:12px; font-weight:600;color:#1165AF;cursor:hand;">注册</a>
</td>
</tr>
<tr>
<td style="font-size:12px; font-weight:600; color:#8D96AA">
密 码:
</td>
<td>
<input type="password" name="logPwd"
style="width:69px; height:18px; border:1px solid #8D96AA;" />
</td>
<td>
<input type="submit" value="登录"
style="background:#FFFFFF; border:1px solid #1165AF; height:18px;font-size:12px; font-weight:600;color:#1165AF; width:30px;cursor:hand;" />
<a href="#"
style="font-size:12px; font-weight:600;color:#1165AF;cursor:hand;"
title="忘记密码">忘记密码</a>
</td>
</tr>
<tr>
<td colspan="3" align="left"
style="font-size:12px; font-weight:600; color:#000000;">
</td>
</tr>
</table>
</form>
解决方案 »
- 实现一个算法,验证成功后会再加30分。谢谢。最好用javascript,不行的话,用java或c++也可以。
- 菜单中append添加的子节点,再为其append添加子节点就出问题了,求指点
- 如何手动调用mouseover?
- 一个关于JS来点亮点击之后连接的问题
- 请求各位大哥一个小问题,马上结贴,谢谢大家
- 如何保存HTML文件中图片的位置到数据库中(急!)
- 帮忙----------file的使用。。。。。。。
- 关于文本框焦点的问题
- 为什么不起作用--代码很短
- 200分求正则,为html里面缺少"的属性加上引号。
- Ext中的柱状图,如何在图上显示各个柱的横纵坐标信息?
- 求解释 jquery使用POST方法返回的数据很乱
<input type="password" name="logPwd" id="logPwd"
<html xmlns="http://www.w3.org/1999/xhtml">兼容性……
把input加上ID就可以了
id=logName
id 你没写 。ie真的没问题 ?
else if(pwd.value.Trim()==""){
在FF中,要用window.document.getElementById,
var userName =document.getElementById("logName");
var pwd =document.getElementById("logPwd");
改成这样:
var userName =$("#logName").text();
var pwd =$("#logPwd").text();