首页 > 编程 > HTML > 正文

XUL中如何插-入一段HTML内容

2020-03-24 15:55:38
字体:
来源:转载
供稿:网友

 XUL内容如下

<?xml version="1.0"?>

<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>

<?xml-stylesheet href="chrome://EasyEffective/content/styles/global.css" type="text/css"?>

<window

id="Test"

title="Test"

xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"

暴走漫画动画系列在线观看[www.62-6.com/1/baozoumanhua/];

xmlns:html="http://www.w3.org/1999/xhtml"

onload="Onload()"

persist="screenX screenY width height sizemode">

<script src="chrome://Test/content/scripts/Test.js" type="application/x-javascript"/>

<vbox flex="1">

<hbox id="aContainer"></hbox>

</vbox>

<statusbar pack="left">

<statusbarpanel flex="1" pack="left"><description>label;</description></statusbarpanel>

<statusbarpanel id="page-report-button" blocked="true"/>

</statusbar>

</window>

  我想要在<hbox id="aContainer"></hbox>内插入一段HTML的代码,代码如下:

  <html:a href="http://mozilla.org">Mozilla.org</html:a>

<html:table>

<html:tr><html:td></html:td></html:tr>

......

......

more content

......

</html:table>

  我怎么把这段代码插入到上面那个hbox里面?

  我用 DOMParser 处理的时候,界面上提示解析错误

  var dp = new DOMParser();

var newDOM = dp.parseFromString(htmlContent, "text/xml");

//this step has Errors

//the Error like this "XML Parsing Error:prefix not bound to namespace..."

document.getElementById('aContainer').appendChild(newDOM.documentElement);

  高手们,请帮帮忙,谢谢了

  我按照你的方法写了一个文件:test.xul

  代码如下:

<?xml version="1.0"?>

<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>

<?xml-stylesheet href="chrome://EasyEffective/content/styles/global.css" type="text/css"?>

<window

id="Test"

title="Test"

xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"

xmlns:html="http://www.w3.org/1999/xhtml"

onload="Onload()"

persist="screenX screenY width height sizemode">

<script src="chrome://Test/content/scripts/Test.js" type="application/x-javascript"/>

<vbox flex="1">

<hbox id="aContainer">

<html:a href="http://mozilla.org">Mozilla.org</html:a>

<html:table>

郑重声明:本文版权归原作者所有,转载文章仅为传播更多信息之目的,如作者信息标记有误,请第一时间联系我们修改或删除,多谢。

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表