[英]execCommand not working for xml file
I am using execCommand command to 'Hilite' selected text on the page which is rendered with gecko engine/gtkmozembed. 我正在使用execCommand命令来“ hilite”页面上选定的文本,该页面是用壁虎引擎/ gtkmozembed呈现的。
if ( !document.execCommand("HiliteColor", false, colour) ) {
document.execCommand("BackColor", false, colour);
}
This is working fine with HTML pages. HTML页面可以很好地工作。 But i have some XML pages( books in xml format).
但是我有一些XML页面(xml格式的书)。 execCommand is not working for those XML pages.
execCommand不适用于这些XML页面。 It gives warning like
它发出警告像
TypeError: document.execCommand is not a function
How can i make execCommand works on XML? 我怎样才能使execCommand在XML上工作? Thanks.
谢谢。
XML has no visual representation layer by default. XML默认没有可视表示层。 It is only a data container.
它只是一个数据容器。 Try transforming the XML documents into HTML documents using XSLT.
尝试使用XSLT将XML文档转换为HTML文档。 Then any JavaScript will work perfectly.
这样,任何JavaScript都将完美运行。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.