【发布时间】:2015-01-20 05:42:08
【问题描述】:
我无法使用 javascript 隐藏我的按钮,我的代码是这样的。 (我使用图像作为按钮)
<img alt="" src="images/search-icon.png" width="16" height="16" style="display: inline;height:16px;cursor:pointer; width: 16px;" onclick="ViewLookUpPayment('<%=btnShowCorpCode.ClientID %>');" />
这是我的 javascript 中的代码。
function ViewLookUpPayment(bShow)
{
var button1 = document.getElementById(bShow);
button1.style.visibility = "visible";
}
每次点击图片都会弹出这个运行时错误
我不明白为什么会出现运行时错误,谁能帮我解决这个问题?
【问题讨论】:
-
你的函数应该有名字吗?
-
@sh1rts 是的,有人刚刚编辑了我的问题。
-
在按钮上将 ID 模式设置为静态。将 ID 设置为已知值。对 javascript 调用进行硬编码。在浏览器中打开并调试。验证您是否确实可以获取该元素,然后放松,直到找到问题为止。
标签: javascript asp.net button