1

我有一个 Xulrunner 应用程序,它在没有任何控件的情况下加载全屏并默认加载一个 html 页面。它唯一拥有的是浏览器元素和右键单击时可见的弹出菜单。在弹出菜单中有退出选项。然后有一个菜单项'theme2'。我希望浏览器在单击 theme2 时加载另一个 html。

这是我的 main.xul,默认加载:

<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<window id="main" title="Edusoft" hidechrome="true" sizemode="maximized" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/x-javascript">
function do()
{
 var browser1 = document.getElementById('browser');
 browser1.loadURI("chrome://myapp/content/theme2/home.html");
}
</script>

<browser id="browser" type="content" src="chrome://myapp/content/theme1/index.html" flex="1" context="clipmenu"/>



<popupset>
  <menupopup id="clipmenu">
       <menuitem label="About Us"/>
    <menuseparator/>
    <menuitem label="Theme2" oncommand="do();"/>
    <menuseparator/>
    <menuitem label="Exit" oncommand="close();"/>
  </menupopup>
</popupset>

</window>

我试过这个,但是当页面以这种方式加载时..弹出菜单不再出现在新页面中。

window.location.assign()

有类似的东西loaduri(),但我不知道如何使用它。

4

1 回答 1

1

好的,我想通了。

document.getElementById('browser').loadURI('chrome://myapp/content/flash/demo.htm')
于 2010-08-01T14:21:46.137 回答