如何更改(从 JavaScript)XUL 窗口的标题?
在 xulrunner 应用程序中,我似乎无法从 JavaScript 设置标题。 我尝试过以下两种方式进行设置:
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<window id="mywindow" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" onload="go();">
<!-- your code here -->
<script type="application/x-javascript">
<![CDATA[
function go(){
document.getElementById("mywindow").title="blar";
document.getElementById("mywindow").setAttribute("title","blar");
}
]]>
</script>
</window>
DOM Inspector 显示标题属性确实已更新,但它未显示在屏幕上。
In a xulrunner app, I seem to be unable to set the title from JavaScript. I have tried setting in these two ways:
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<window id="mywindow" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" onload="go();">
<!-- your code here -->
<script type="application/x-javascript">
<![CDATA[
function go(){
document.getElementById("mywindow").title="blar";
document.getElementById("mywindow").setAttribute("title","blar");
}
]]>
</script>
</window>
DOM Inspector shows that the title attribute does get updated, but it does not show up on screen.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这有效
This works
页面加载后似乎无法更改窗口。 如果有办法,我很想知道......但这确实有效:
It appears that after the page loads one cannot change the window. If there is a way, I'd be interested to know it.. but this does work: