首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > JavaScript >

小弟我的表单只能在火狐上提交

2012-12-30 
我的表单只能在火狐下提交form namename actiona.php methodgetinput typetext nameabbb

我的表单只能在火狐下提交
<form name="name" action="a.php" method="get">
<input type="text" name="abbb" value="" />
<input id="ab" type="submit" name="submitform" onclick="return checkform()" value="提交" />
</form>

<script type="text/javascript">
function checkform() {
document.getElementById("ab").disabled = "disabled";
return true;
}
</script>

上面的代码只能在火狐下工作,其它浏览器都不能提交,提交按钮变灰之后就没有动静了
如果使用jquery,把“document.getElementById("ab").disabled="disabled"改成“$("#ab").disabled="disabled"”就没有问题了。
问题是,为什么用document.getElementById就不行呢?
请问有谁可以帮我找到是什么原因吗?
[解决办法]
document.getElementById("ab")[0].disabled = "disabled";
这样就好了。。。。。
[解决办法]
我觉得你要先提交然后再禁用按钮
[解决办法]
楼主的方法不好,用这种

<form name="name" action="a.php" method="get" onsubmit="return checkform()">
<input type="text" name="abbb" value="" />
<input id="ab" type="submit" name="submitform" value="提交" />
</form>

<script type="text/javascript">
function checkform() {
document.getElementById("ab").disabled = "disabled";
return true;
}
</script>

[解决办法]
    function checkform() {
        document.getElementById("ab").disabled = "disabled";
        document.name.submit()
        return true;
    }

热点排行