在 JavaScript 中获取参数值
在 Cognos 8.4 中,我有一个提示符 "NAME" 及其参数 p_name。
如何通过 JavaScript 获取该参数?
<script>
alert(p_name)
</script>
显示 JavaScript 错误。为什么?
我的做法正确吗?
In Cognos 8.4, I have a prompt, "NAME", and its parameter p_name.
How do I get that parameter through JavaScript?
<script>
alert(p_name)
</script>
shows a JavaScript error. Why?
Is my approach correct?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
也许对象的引用会丢失,并且您必须跟上变量或参数的范围。您可以通过按“f12”在 Internet Explorer 8 中使用“开发人员工具”。在右侧面板中,您可以选择选项卡“console”来查找出错的位置,或者您可以选择选项卡“locals”来查找参数是否有您调用它的范围内的任何值。
Maybe the reference for the object will be missing, and you have to keep up with the scope of the variables or the parameters. You can use the "Developer Tools" in Internet Explorer 8 by pressing "f12". There in the right hand side pan you can choose the tab "console" to find where you went wrong or you can choose the tab "locals" to find whether the parameter has any values in the scope where you are calling it.
我不了解 Cognos,但您的问题是您正在调用全局范围内对象的本地变量。你必须做
whatEverTheObjectIsCalled.p_name
(可能)。准确找出您要查找的内容的一个简单方法是在 Chrome 和console.log(theObject)
中启动网页,然后浏览对象的内部结构,直到找到所需的属性。I don't know Cognos, but your problem is that you are calling a variable that is local to an object in the global scope. You have to do
whatEverTheObjectIsCalled.p_name
(probably). An easy way to find out exactly what you are looking for is to fire up the web page in Chrome andconsole.log(theObject)
and browse through the internals of the object until you find the attribute you want.