代码在 Internet Explorer 8 中不起作用
Code not working in internet explorer 8
下面的代码在 Google chrome 但在 Internet Explorer 8 中运行良好。我没有在任何高于 Internet Explorer 8 的环境中测试它,因为我们这里有所有 XP 机器。有没有我可以放入的片段以强制它在 Internet Explorer 中工作,或者我使用的是 Internet Explorer 不支持的东西??
代码
<!DOCTYPE html>
<html>
<head>
<style>
<!-- css for styling the button to make it appear as a link instead -->
button {background:none!important; border:none; padding:0!important;
/*optional*/
font-family:arial,sans-serif; /*input has OS specific font-family*/
color:#069;
text-decoration: none;
cursor:pointer;
}
body { background-color:white; }
block1{display:block; background-color:#E6E6B8 ; color:black; padding:10px; margin:5px;}
block1.a{display:none; background-color:#E6E6B8 ; color:black; padding:10px; margin:5px;}
<!-- End of the CSS Styling -->
</style>
</head>
<body background-color:#E6E6B8>
<button onclick="document.getElementById('ID').setAttribute('class', '');"> <b><abbr title="Click to expand">Current Status Report</b></button><br>
<block1 id="ID" class="a">
<p>
 <a href="#" >Current Status Report With Legal Process</a><br>
 <a href="#">Current Status Report<br></a>
 <a href="#">Current Status Report With Last Response<br></a>
 <a href="#">Current Status Report With Last Receipt<br></a>
 <a href="#">Current Status Report With Last Response and Plaintiff<br></a>
 <a href="#">Current Status Report by Date Transferred<br></a>
 <a href="#">New Business This Period<br></a>
 <a href="#">Letter Before Action Sent</p></a>
<button onclick="document.getElementById('ID').setAttribute('class', 'a');"><b>Hide -</b></button>
</block1>
<button onclick="document.getElementById('ID2').setAttribute('class', '');"> <b>Defended Cases (click for more) +</b></button>
<block1 id="ID2" class="a">
<p>
 Defended Cases<br>
 Cases Awaiting Affidavits<br>
 Cases where Judgment has been Obtained<br>
 Awaiting Instructions on Judgments<br>
 Cases With The Sheriff For Execution<br>
 Cases With Enforcement Proceedings Commenced<br>
 Instalment Orders Obtained<br>
 Instalment Orders Served<br>
 Cases Awaiting Instructions for Committal<br>
 Committal Summons Report<br>
 Forthcoming Committal Hearings Report<br>
 Outstanding Committal Warrants<p>
<button onclick="document.getElementById('ID2').setAttribute('class', 'a');"><b>Close - </b></button>
</block2>
</body>
</html>
在 .
中添加以下行
<meta http-equiv="X-UA-Compatible" content="IE=9; IE=8; IE=7; IE=EDGE" />
您可以将您的 IE 版本放在内容属性中。
您的 CSS 代码 中有 HTML 注释,可能会在 IE8 上中断:
<!-- css for styling the button to make it appear as a link instead -->
button {background:none!important; border:none; padding:0!important;
/*optional*/
font-family:arial,sans-serif; /*input has OS specific font-family*/
color:#069;
text-decoration: none;
cursor:pointer;
}
body { background-color:white; }
block1{display:block; background-color:#E6E6B8 ; color:black; padding:10px; margin:5px;}
block1.a{display:none; background-color:#E6E6B8 ; color:black; padding:10px; margin:5px;}
<!-- End of the CSS Styling -->
将其更改为:
/* css for styling the button to make it appear as a link instead */
button {background:none!important; border:none; padding:0!important;
/*optional*/
font-family:arial,sans-serif; /*input has OS specific font-family*/
color:#069;
text-decoration: none;
cursor:pointer;
}
body { background-color:white; }
block1{display:block; background-color:#E6E6B8 ; color:black; padding:10px; margin:5px;}
block1.a{display:none; background-color:#E6E6B8 ; color:black; padding:10px; margin:5px;}
/* End of the CSS Styling */
您的 HTML 也存在重大问题:<block1>
和 <block2>
无效 HTML 元素 。将它们更改为 <section>
、<div>
或任何真正的 HTML 元素。
一些文档给你:https://developer.mozilla.org/en-US/docs/Web/HTML/Element
我很惊讶 Chrome / Firefox 能够正确呈现。此代码无意义。
下面的代码在 Google chrome 但在 Internet Explorer 8 中运行良好。我没有在任何高于 Internet Explorer 8 的环境中测试它,因为我们这里有所有 XP 机器。有没有我可以放入的片段以强制它在 Internet Explorer 中工作,或者我使用的是 Internet Explorer 不支持的东西??
代码
<!DOCTYPE html>
<html>
<head>
<style>
<!-- css for styling the button to make it appear as a link instead -->
button {background:none!important; border:none; padding:0!important;
/*optional*/
font-family:arial,sans-serif; /*input has OS specific font-family*/
color:#069;
text-decoration: none;
cursor:pointer;
}
body { background-color:white; }
block1{display:block; background-color:#E6E6B8 ; color:black; padding:10px; margin:5px;}
block1.a{display:none; background-color:#E6E6B8 ; color:black; padding:10px; margin:5px;}
<!-- End of the CSS Styling -->
</style>
</head>
<body background-color:#E6E6B8>
<button onclick="document.getElementById('ID').setAttribute('class', '');"> <b><abbr title="Click to expand">Current Status Report</b></button><br>
<block1 id="ID" class="a">
<p>
 <a href="#" >Current Status Report With Legal Process</a><br>
 <a href="#">Current Status Report<br></a>
 <a href="#">Current Status Report With Last Response<br></a>
 <a href="#">Current Status Report With Last Receipt<br></a>
 <a href="#">Current Status Report With Last Response and Plaintiff<br></a>
 <a href="#">Current Status Report by Date Transferred<br></a>
 <a href="#">New Business This Period<br></a>
 <a href="#">Letter Before Action Sent</p></a>
<button onclick="document.getElementById('ID').setAttribute('class', 'a');"><b>Hide -</b></button>
</block1>
<button onclick="document.getElementById('ID2').setAttribute('class', '');"> <b>Defended Cases (click for more) +</b></button>
<block1 id="ID2" class="a">
<p>
 Defended Cases<br>
 Cases Awaiting Affidavits<br>
 Cases where Judgment has been Obtained<br>
 Awaiting Instructions on Judgments<br>
 Cases With The Sheriff For Execution<br>
 Cases With Enforcement Proceedings Commenced<br>
 Instalment Orders Obtained<br>
 Instalment Orders Served<br>
 Cases Awaiting Instructions for Committal<br>
 Committal Summons Report<br>
 Forthcoming Committal Hearings Report<br>
 Outstanding Committal Warrants<p>
<button onclick="document.getElementById('ID2').setAttribute('class', 'a');"><b>Close - </b></button>
</block2>
</body>
</html>
在 .
中添加以下行<meta http-equiv="X-UA-Compatible" content="IE=9; IE=8; IE=7; IE=EDGE" />
您可以将您的 IE 版本放在内容属性中。
您的 CSS 代码 中有 HTML 注释,可能会在 IE8 上中断:
<!-- css for styling the button to make it appear as a link instead -->
button {background:none!important; border:none; padding:0!important;
/*optional*/
font-family:arial,sans-serif; /*input has OS specific font-family*/
color:#069;
text-decoration: none;
cursor:pointer;
}
body { background-color:white; }
block1{display:block; background-color:#E6E6B8 ; color:black; padding:10px; margin:5px;}
block1.a{display:none; background-color:#E6E6B8 ; color:black; padding:10px; margin:5px;}
<!-- End of the CSS Styling -->
将其更改为:
/* css for styling the button to make it appear as a link instead */
button {background:none!important; border:none; padding:0!important;
/*optional*/
font-family:arial,sans-serif; /*input has OS specific font-family*/
color:#069;
text-decoration: none;
cursor:pointer;
}
body { background-color:white; }
block1{display:block; background-color:#E6E6B8 ; color:black; padding:10px; margin:5px;}
block1.a{display:none; background-color:#E6E6B8 ; color:black; padding:10px; margin:5px;}
/* End of the CSS Styling */
您的 HTML 也存在重大问题:<block1>
和 <block2>
无效 HTML 元素 。将它们更改为 <section>
、<div>
或任何真正的 HTML 元素。
一些文档给你:https://developer.mozilla.org/en-US/docs/Web/HTML/Element
我很惊讶 Chrome / Firefox 能够正确呈现。此代码无意义。