【发布时间】:2015-06-14 07:28:18
【问题描述】:
我有一个表单页面,它从弹出窗口向数据库提交数据。我为提交数据添加了一个禁用按钮 js。它在 ie11 上不起作用,但在其他浏览器上完美运行。
<script language="javascript" type="text/javascript">
// disables the button specified and sets its style to a disabled "look".
function disableButtonOnClick(oButton, sButtonText, sCssClass)
{
// set button to disabled so you can't click on it.
oButton.disabled = true;
// change the text of the button.
oButton.value = sButtonText;
// IE uses className for the css property.
oButton.setAttribute('className', sCssClass);
// Firefox, Safari use class for the css property.
oButton.setAttribute('class', sCssClass);
}
</script>
【问题讨论】:
-
-
Avyy lmao,我会把它添加到问题中。
-
但与脚本无关。我猜它有一些浏览器问题。
-
在 IE 上转到“设置 -> Internet 选项 -> 高级 -> 浏览 -> 禁用脚本调试 (Internet Explorer)”并取消选中该选项。如果你遇到 javascript 错误,IE 会在错误上中断,你可以打开一个调试窗口。您将能够查明错误以及遇到错误的行号。
-
为什么要使用
setAttribute而不是直接设置属性?
标签: javascript c# asp.net internet-explorer internet-explorer-11