2014-04-24 4 views
0

아래 기능은 IE 9 이상에서 작동하지만 텍스트는 IE 8 이하에는 표시되지 않습니다.텍스트가 IE8 이하에 표시되지 않습니다

HTML :

<body onLoad="BuildBrwsrInfoMsg();" style="background: url('../images/BeachBackground.jpg'); margin-top:0; " id="LoadingDisplay" > 

스크립트

function BuildBrwsrInfoMsg() 
       { 
    var maindiv = document.getElementById('Background-Header'); 
    var div = document.createElement('div'); 
    div.setAttribute('id', 'browserInfo'); 
    var spanBrwsrNameVersion = document.createElement('span'); 
    spanBrwsrNameVersion.textContent = "Browser Not Supported - You are using ("+ bowser.name + ' ' + bowser.version + ")"; 
    spanBrwsrNameVersion.setAttribute('class', 'BrowersTitle'); 
    div.appendChild(spanBrwsrNameVersion); 
    var spanBrwsrMsg = document.createElement('span'); 
    spanBrwsrMsg.textContent = "This browser may not be compatible with our website. For best results, it is suggested that you upgrade to the latest version. To download the latest version Click"; 
    spanBrwsrMsg.setAttribute('class', 'BrowersDescription'); 
    div.appendChild(spanBrwsrMsg); 

    var hideBtn = document.createElement('input'); 
    hideBtn.setAttribute('id', 'btnHideMsg'); 
    hideBtn.setAttribute('type', 'submit'); 
    hideBtn.setAttribute('value', 'Hide Message'); 
    div.appendChild(hideBtn); 

     maindiv.insertBefore(div, maindiv.firstChild);           
    } 

답변

2

그것은 모든 아닙니다 official documentations about the textContent property에 확인있어 IE < (9)에 의해 지원되는 textContent 부동산에 관한입니다.

+0

어쨌든 IE가 지원하는 공식 문서는 어쨌든, 링크 된 페이지 힌트로서, OP가 얻으려는 것이 무엇인지에 대해, IE8 기반 API에서'textContent' 대신'innerText'를 사용할 수 있습니다. . 이 코드는 jQuery를 사용하면 훨씬 간단 해지고 훨씬 짧아집니다 (가능한 경우). – jods

관련 문제