I'm troubleshooting a java script witch creates a web page. It uses this sequence:
aTD=document.createElement("TH");
header.appendChild(aTD);
the problem is that in some point of the script, this 开发者_JAVA技巧goes as:
aTD=document.createElement("<TH>");
aTD.appendChild(document.createTextNode(a4Phrase.TOTAL));
header.appendChild(aTD)
in IE this is not one issue. But in Firefox the page creation fails at this point so only half of the page is displayed. I've tried in last days to figure out one solution but no sucess. So here is my question:
How can I change(using greasemonkey)
aTD=document.createElement("<TH>");
to
aTD=document.createElement("TH");
?
It looks like a dirty hack and I suppose your problem can be solved in some another more accurate way. However you can just proxy document.createElement
method:
var ce = document.createElement;
document.createElement = function(el){
if (el === '< TH>') {
el = 'TH';
}
return ce.call(document, el);
};
var aTD=document.createElement("< TH>");
aTD;
精彩评论