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.
if ( !document.execCommand("HiliteColor", false, colour) ) {
document.execCommand("BackColor", false, colour);
}
This is working fine with HTML pages. But i have some XML pages( books in xml format). execCommand is not开发者_如何学编程 working for those XML pages. It gives warning like
TypeError: document.execCommand is not a function
How can i make execCommand works on XML? Thanks.
XML has no visual representation layer by default. It is only a data container. Try transforming the XML documents into HTML documents using XSLT. Then any JavaScript will work perfectly.
精彩评论