简体   繁体   English

在Win7上使用IE11的Javascript运行时错误:无法设置未定义或空引用的属性“禁用”

[英]Javascript runtime error using IE11 on Win7: Unable to set property 'disabled' of undefined or null reference

I am currently working on some IE11 compatibility issues. 我目前正在处理某些IE11兼容性问题。 The code is fully functional in compatibility mode as it was previously optimize last for IE5. 该代码在兼容模式下具有完整的功能,因为它先前针对IE5进行了最后优化。

The affected code is as follows: 受影响的代码如下:

/*
 * This function sets the specified button state in the repair processing form
 */
function setOperationButton(buttonId, disabledState, sourceImage, styleCursor)
{
    var buttonElement = document.frmRepairProcessing.elements[buttonId];
    var sourceRoot = '<%=helper.getApplicationURL()%>' + '/zimages/' + '<%=localeString%>' + '/';
    buttonElement.disabled = disabledState;
    buttonElement.src = sourceRoot + sourceImage;
    buttonElement.style.cursor = styleCursor;   
}

So I am thinking the code simply needs to be updated to use getElementById, but I am not quite sure how to implement the specific form. 因此,我认为只需更新代码即可使用getElementById,但是我不确定如何实现特定形式。

Please note: I have also tried document.forms().elements() and using .value as well. 请注意:我也尝试了document.forms()。elements()并也使用.value。

I believe it will be acceptable to use below code to obtain buttonElement: 我相信使用下面的代码来获取buttonElement是可以接受的:

function setOperationButton(buttonId, disabledState, sourceImage, styleCursor)
{
    var buttonElement = document.getElementById(buttonId);
    var sourceRoot = '<%=helper.getApplicationURL()%>' + '/zimages/' + '<%=localeString%>' + '/';
    buttonElement.disabled = disabledState;
    buttonElement.src = sourceRoot + sourceImage;
    buttonElement.style.cursor = styleCursor;   
}

暂无
暂无

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

相关问题 IE11无法获取未定义或空引用的属性“值” - IE11 Unable to get property 'value' of undefined or null reference JavaScript运行时错误:无法设置未定义或空引用的属性“ WebKit” - JavaScript runtime error: Unable to set property 'WebKit' of undefined or null reference AG-Grid在IE11中具有vue错误挂接钩中出现错误:“ TypeError:无法获取未定义或空引用的属性&#39;addEventListener&#39; - AG-Grid with vue error in IE11 Error in mounted hook: “TypeError: Unable to get property 'addEventListener' of undefined or null reference” SCRIPT5007:无法在 IE11 中获取未定义或空引用的属性“值” - SCRIPT5007: Unable to get property 'value' of undefined or null reference in IE11 Angular2 IE11 无法获取未定义或空引用的属性“应用” - Angular2 IE11 Unable to get property 'apply' of undefined or null reference 无法获取未定义或空引用的属性“应用”-IE11和Chrome - Unable to get property 'apply' of undefined or null reference - IE11 and Chrome JavaScript运行时错误:无法获取未定义或空引用的属性“值” - JavaScript runtime error: Unable to get property 'value' of undefined or null reference JavaScript运行时错误:无法获取未定义或空引用的属性“msie” - JavaScript runtime error: Unable to get property 'msie' of undefined or null reference javascript运行时错误:无法获取未定义或空引用的属性“替换” - javascript runtime error: unable to get property 'replace' of undefined or null reference JavaScript运行时错误:无法获取未定义或空引用的属性“ length” - JavaScript runtime error: Unable to get property 'length' of undefined or null reference
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM