JavaScript window.status
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3273320/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
JavaScript window.status
提问by iTEgg
hi this is my first attempt at JavaScript:
嗨,这是我第一次尝试 JavaScript:
the following function is used to display window status bar messages. it works fine on the local machine but when i upload it too the server the messages are not displayed at all.
以下函数用于显示窗口状态栏消息。它在本地机器上工作正常,但是当我也上传它时,服务器根本不显示消息。
what am i doing wrong? please help.
我究竟做错了什么?请帮忙。
[website][link removed]
[网站][链接已删除]
function displayMsg(msg){
window.status = msg;
}
what should happen is when you hover over the image it should display a message to click it and the image is then updated.
应该发生的是,当您将鼠标悬停在图像上时,它应该显示一条消息以单击它,然后图像就会更新。
i saw thisbut if this is no longer possible then why does it work locally?
我看到了这个,但如果这不再可能,那么为什么它在本地工作?
EDIT: thank you for your answer. i am wondering if it is possible to display a tooltip once the image over event happens? thanks,
编辑:谢谢你的回答。我想知道一旦图像结束事件发生是否可以显示工具提示?谢谢,
EDIT: i have added a Title attribute and it seems to display a tooltip. what you are seeing would be most welcome input. thanks.
编辑:我添加了一个 Title 属性,它似乎显示了一个工具提示。您所看到的将是最受欢迎的输入。谢谢。
EDIT: Google Chrome works fine. Safari does not run javascript. im on win7.
编辑:谷歌浏览器工作正常。Safari 不运行 javascript。我在win7。
回答by Unicron
window.statushas been disabled in most (if not all) browsers for security reasons (it was possible to fake a different location for links that way).
window.status出于安全原因,在大多数(如果不是全部)浏览器中已被禁用(可以通过这种方式伪造链接的不同位置)。
See e.g. the MDC pageon window.status:
参见window.status 上的 MDC 页面:
This property does not work in default configuration of Firefox and some other browsers: setting window.status has no effect on the text displayed in the status bar. To allow scripts change the the status bar text, the user must set the dom.disable_window_status_change preference to false in the about:config screen.
此属性在 Firefox 和其他一些浏览器的默认配置中不起作用:设置 window.status 对状态栏中显示的文本没有影响。要允许脚本更改状态栏文本,用户必须在 about:config 屏幕中将 dom.disable_window_status_change 首选项设置为 false。
it was also removed in IE 7.
它也在 IE 7 中被删除。
As to why it works locally, I can't say. Maybe security restrictions are more relaxed there, although it's strange!
至于为什么它在本地工作,我不能说。也许那里的安全限制更宽松,虽然很奇怪!

