简体   繁体   English

Microsoft JScript运行时错误:无法获取属性“样式”的值:对象为null或未定义

[英]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.

相关问题 Microsoft JScript运行时错误:无法获取属性&#39;removeChild&#39;的值:对象为null或未定义 - Microsoft JScript runtime error: Unable to get value of the property 'removeChild': object is null or undefined Microsoft JScript运行时错误:“null”为null或不是对象 - Microsoft JScript runtime error: 'null' is null or not an object asp.net jscript错误:无法获取未定义或空引用的属性“值” - asp.net jscript Error: Unable to get property 'value' of undefined or null reference 无法获取属性“ length”的值:对象为null或未定义-Javascript错误 - Unable to get value of the property 'length': object is null or undefined - Javascript Error Microsoft JScript运行时错误:“ data.EmployeeDetails.EmployeeId”为null或不是对象` - Microsoft JScript runtime error: 'data.EmployeeDetails.EmployeeId' is null or not an object` Microsoft JScript 运行时错误:'Sys.Extended.UI' 是 null 或者不是 object - Microsoft JScript runtime error: 'Sys.Extended.UI' is null or not an object Javascript运行时错误:无法获取动态创建的文本框的未定义或空引用的属性“样式” - Javascript Runtime Error: Unable to get property 'style' of undefined or null reference of dynamically created Textboxes Microsoft JScript运行时错误:对象不支持此属性或方法 - Microsoft JScript runtime error: Object doesn't support this property or method Microsoft JScript运行时错误:对象不支持此属性或方法 - Microsoft JScript runtime error: Object doesn't support this property or method Microsoft JScript运行时错误:“ clientUploadComplete”未定义 - Microsoft JScript runtime error: 'clientUploadComplete' is undefined
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM