繁体   English   中英

Internet Explorer 11中的JavaScript错误

[英]JavaScript Error in Internet Explorer 11

我有一个表单页面,从弹出窗口向数据库提交数据。我为提交数据添加了一个禁用的按钮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>

尝试以下代码

if((navigator.userAgent.indexOf("MSIE") != -1 )
oButton.setAttribute('className', sCssClass); 
else
oButton.setAttribute('class', sCssClass);

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM