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