我是TryAgain的Firefox开发者之一,它在网站加载失败时显示自定义错误页面。它本质上取代了Firefox的netError.xhtml
自定义版本。XUL按钮不出现
但是,我遇到了3.0 * .3.6。*和Fx4b5之间的一些相当的终端兼容性问题。 (在netError.dtd的条目已更名,导致任何一个版本或其他一个XML解析错误。)
为了解决这个问题,我已经决定要具有扩展动态修改页面,反对完全替换它。我需要在Fx3中添加到netError.xhtml
的一个元素是<xul:button>
。然而,用下面的代码添加它,没有出现在屏幕上:
var div = document.getElementById("errorContent");
var btn = document.createElement("xul:button");
btn.setAttribute("label", "Hello world");
btn.setAttribute("oncommand", "alert('Hello world!');");
div.appendChild(btn);
我看到在Mozilla开发者中心是there is this note:
Gecko implementation of createElement doesn't conform to the DOM spec for XUL and XHTML documents: localName and namespaceURI are not set to null on the created element. See bug 280692 for details.
这是什么继承权问题,以及哪能解决它?
此外,如何通过JavaScript执行oncommand
事件?
你试过用createElementNS(” http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul“,”xul:button“)? – lithorus 2010-09-14 22:05:30