Javascript:DOM异常:INVALID_CHARACTER_ERR(5)

时间:2011-05-29 19:26:25

标签: javascript internet-explorer-9

我使用新的IE 9测试了我的网站,我收到错误告诉我INVALID_CHARACTER_ERR(5)。在IE 9中,开发人员工具突出了这一行。任何人都可以帮我解决这个错误吗?

错误行

this.iframe = document.createElement('<IFRAME src="' + myCurrentUrl + '" frameborder=0>');


Function Code
__createDivs : function()
{
this.divs_transparentDiv = document.createElement('DIV');
this.divs_transparentDiv.className='modalDialog_transparentDivs';
this.divs_transparentDiv.style.left = '0px';
this.divs_transparentDiv.style.top = '0px';
document.body.appendChild(this.divs_transparentDiv);
this.divs_content = document.createElement('DIV');
this.divs_content.className = 'modalDialog_contentDiv';
this.divs_content.id = 'DHTMLSuite_modalBox_contentDiv';
this.divs_content.style.zIndex = 100000;
if(this.MSIE){
var myCurrentUrl = GlobPanelCurrentBaseUrl + 'images/spacer.gif';
this.iframe = document.createElement('<IFRAME src="' + myCurrentUrl + '" frameborder=0>');
this.iframe.style.zIndex = 90000;
this.iframe.style.position = 'absolute';
document.body.appendChild(this.iframe); 
}
document.body.appendChild(this.divs_content);
this.divs_shadow = document.createElement('DIV');
this.divs_shadow.className = 'modalDialog_contentDiv_shadow';
this.divs_shadow.style.zIndex = 95000;
document.body.appendChild(this.divs_shadow);
window.refToModMessage = this;
this.addEvent(window,'scroll',function(e){ window.refToModMessage.__repositionTransparentDiv() });
this.addEvent(window,'resize',function(e){ window.refToModMessage.__repositionTransparentDiv() });
}

1 个答案:

答案 0 :(得分:10)

是的,您应该只给它元素的名称,然后像这样设置属性:

this.iframe = document.createElement('iframe');
this.iframe.src = myCurrentUrl;
this.iframe.frameBorder = 0;