如何在弹出窗口中启用window.status?
我正在使用
window.status = "myStatusText"
它在我的应用程序的普通窗口中工作正常,但是如果我想在普通的老式弹出窗口中使用此功能,它就不起作用。
弹出窗口的状态栏可见。我可以在状态栏中看到超链接的原始 URL,并且我想隐藏它们。
window.status 不会覆盖弹出窗口中的原始文本,这正常吗?
<span id="mySpan" class="mySpanClass">
<a id="myLink" href="javascript:myClickFunction();" onmouseover="window.status='myWindowStatus';" onmouseout="window.status='';" >Link</a>
</span>
我已经删除了 onmouseout 事件,现在在鼠标指向链接后 onmouseover-text 可见!
I'm using
window.status = "myStatusText"
And it's working fine in a normal window in my application, but if I want to use this function in a normal old-fashioned popup-window, it is not working.
The statusbar of the popup is visible. I can see the original URLs of the hyperlinks in the statusbar and i want to hide them.
Is this normal, that window.status does not override the original text in a popup?
<span id="mySpan" class="mySpanClass">
<a id="myLink" href="javascript:myClickFunction();" onmouseover="window.status='myWindowStatus';" onmouseout="window.status='';" >Link</a>
</span>
I've removed the onmouseout event and now the onmouseover-text is visible, AFTER the mouse was pointing the link!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我意识到我们需要取消内置浏览器对事件的处理。这很简单:
您可能是,但是您是否在 window.open 方法中提供 status=1 ?
例如:
某些浏览器(例如 IE)仅在站点不受信任时才在弹出窗口中显示状态栏,因此,例如在 Intranet 站点上,除非您专门添加 status=1,否则不会显示状态酒吧。
如果您可以看到状态栏,那么您是否遇到了特定错误,或者根本就不起作用?
您可以通过弹出窗口内的某些脚本设置状态栏的文本吗?
I realised that we need to cancel the inbuilt browser handling of the event. This is simple to do:
You probably are, but are you supplying status=1 in the window.open method?
For example:
Some browsers, for example IE, only show the status bar in a popup window if the site isn't trusted, so, for example, on an intranet site, unless you specifically add status=1, it wont show the status bar.
If you can see the status bar, are you getting a particular error or is it just not working at all?
Can you set the text of the status bar from some script inside the popup window?
这样打开弹出窗口
window.open("you url", "mywindow","status=1,toolbar=1");
Open the popup window this way
window.open ("you url", "mywindow","status=1,toolbar=1");
使用 status=yes 打开弹出窗口,它将起作用。 –(查看MDN 上的window.open 文档)
Open the popup with status=yes and it will work. – (check window.open documentation on MDN)