我的图片上有一个onclick代码,以禁用表单上的按钮,如下所示
<img alt="" src="images/search-icon.png" width="16" height="16" style="display: inline;height:16px;cursor:pointer; width: 16px;" onclick="DisableButton('<%=btnSave.ClientID %>');" />
然后在我的JavaScript上,我有一个像这样的代码
function DisableButton(bSave) {
document.getElementById(bSave).attributes("Enabled", false);
}
问题是它不起作用,每次我单击图像时都没有任何反应。我的代码有错误吗?请帮我这个。先感谢您。
最佳答案
使用“禁用”document.getElementById(bSave).disabled = true;
http://www.w3schools.com/jsref/prop_html_disabled.asp
清除禁用vs禁用歧义。