我的代码是:
function htmlEncode (str){
var div = document.createElement("div");
div.textContent=str;
return div.innerHTML;
}
在其他页面可以正常工作,但在xul中不行,谁能帮助我?
更新:
答案是:
function htmlEncode (str){
var div = document.createElementNS("http://www.w3.org/1999/xhtml","div");
div.textContent=str;
return div.innerHTML;
}
最佳答案
我相信你必须使用 document.createElementNS相反。
关于javascript htmlencode 在 FireFox XUL 中不起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9955757/