[英]Microsoft JScript runtime error: Unable to get value of the property 'style': object is null or undefined
This is my code line throwing error 这是我的代码行抛出错误
$get("Panel1").style.visibility= "visible";
This line works well on normal page .But whenever using it on child page which owns a master page it throws the error as "Microsoft JScript runtime error: Unable to get value of the property 'style': object is null or undefined". 该行在普通页面上运行良好。但是,如果在拥有母版页的子页面上使用它,则会引发错误为“ Microsoft JScript运行时错误:无法获取属性'style'的值:对象为null或未定义”。 I am a great beginner to javascript .
我是javascript的入门者。 I am using this on Asp.Net 3.5 .Any one know this issue before .
我在Asp.Net 3.5上使用此工具。任何人以前都知道此问题。
Your problem is probably because you do not use the rendered id, that is change if you use the same panel on dipper page. 您的问题可能是因为您不使用渲染的ID,如果在北斗七星页面上使用相同的面板,则可能会发生变化。 And because you do not use the correct id, the
$get()
part return the null or undefined
. 并且由于未使用正确的ID,因此
$get()
部分返回null or undefined
。 Change your code to: 将您的代码更改为:
$get("<%=Panel1.ClientID%>").style.visibility= "visible";
and render the panel1 id as it will final be on the html page. 并渲染panel1 id,因为它将最终显示在html页面上。
What you should have to solve it alone: You could on the page to see the "view page source" from your browser utility and see if the Panel1
id exist on your html struct, there you can find what was the correct id and the reason that was not found. 您应该单独解决的问题:您可以在页面上从浏览器实用程序中查看“查看页面源代码”,并查看
Panel1
id是否存在于html结构中,在那里您可以找到正确的ID及其原因找不到。 So the point here is that we look the html rendered page to find out whats going wrong with the scripts. 因此,这里的要点是,我们查看html呈现的页面,以找出脚本出了什么问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.