Javascript:DOM异常:无效字符错误(5)

Javascript:DOM异常:无效字符错误(5),javascript,internet-explorer-9,Javascript,Internet Explorer 9,我用新的IE9测试了我的站点,结果发现错误告诉我无效字符错误(5)。在IE9中,开发者工具突出显示了这一行。有人能帮我解决这个错误吗 误差线 this.iframe = document.createElement('<IFRAME src="' + myCurrentUrl + '" frameborder=0>'); Function Code __createDivs : function() { this.divs_transparentDiv = document.cr

我用新的IE9测试了我的站点,结果发现错误告诉我无效字符错误(5)。在IE9中,开发者工具突出显示了这一行。有人能帮我解决这个错误吗

误差线

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() });
}
this.iframe=document.createElement(“”);
功能代码
__createDivs:function()
{
this.divs_transparentDiv=document.createElement('DIV');
this.divs_transparentDiv.className='modaldialdialog_transparentDivs';
this.divs_transparentDiv.style.left='0px';
this.divs_transparentDiv.style.top='0px';
document.body.appendChild(此.divs\u transparentDiv);
this.divs_content=document.createElement('DIV');
this.divs_content.className='modaldialdialog_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(“”);
this.iframe.style.zIndex=90000;
this.iframe.style.position='absolute';
document.body.appendChild(this.iframe);
}
document.body.appendChild(此.divs_内容);
this.divs_shadow=document.createElement('DIV');
this.divs_shadow.className='modaldialdialog_contentDiv_shadow';
this.divs_shadow.style.zIndex=95000;
document.body.appendChild(this.divs_shadow);
window.refToModMessage=此;
addEvent(window,'scroll',函数(e){window.refToModMessage.\uu respositiontransparentdiv()});
addEvent(窗口,'resize',函数(e){window.refToModMessage.\uu respositiontransparentdiv()});
}

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

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

谢谢,我刚刚能够使用下面的this.iframe=document.createElement(“iframe”);this.iframe.setAttribute(“src”,myCurrentUrl);this.iframe.setAttribute(“样式”,“位置:绝对;z索引:90000;”);this.iframe.frameBorder=0;仅供参考,旧版本的IE允许您将任意HTML传递到createElement,但这违反了规范。