【发布时间】:2015-04-20 22:10:00
【问题描述】:
IE11 的问题,我有下拉多级(下拉)菜单在 Chrome 和 FireFox 中工作,但在 IE11 中不工作,这样我可以只更改一个文件,而不必去到每一页来改变菜单。我需要三层菜单。(感谢 Frogmouth 的帮助): multi-level (drop down) menu css js
我尝试过 HTML 不同的 !DOCTYPE 但不起作用。
如何解决这个 IE 菜单问题?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>PHP Demo</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<link href="site123.css" rel="stylesheet">
</head>
<body>
<nav id="nav01"></nav>
<script type="text/javascript" language="javascript" src="Menu-Script.js"></script>
<div id="main">
<h1>Welcome to Our Site</h1>
<h2>Web Site Main Ingredients:</h2>
<p>Pages (HTML)</p>
<p>Style (CSS)</p>
<p>Code (JavaScript)</p>
<footer id="foot01"></footer>
</div>
</body>
</html>
我有 CSS(文件名:site123.css)
ul#third-level-menu
{
position: absolute;
top: 0;
right: -150px;
width: 150px;
list-style: none;
padding: 0;
margin: 0;
display: none;
}
ul#third-level-menu > li
{
height: 30px;
background: #999999;
}
ul#third-level-menu > li:hover { background: #CCCCCC; }
ul#second-level-menu
{
position: absolute;
top: 30px;
left: 0;
width: 150px;
list-style: none;
padding: 0;
margin: 0;
display: none;
}
ul#second-level-menu > li
{
position: relative;
height: 30px;
background: #999999;
}
ul#second-level-menu > li:hover { background: #CCCCCC; }
ul#top-level-menu
{
list-style: none;
padding: 0;
margin: 0;
}
ul#top-level-menu > li
{
position: relative;
float: left;
height: 30px;
width: 150px;
background: #999999;
}
ul#top-level-menu > li:hover { background: #CCCCCC; }
ul#top-level-menu li:hover > ul
{
/* On hover, display the next level's menu */
display: inline;
}
/* Menu Link Styles */
ul#top-level-menu a /* Apply to all links inside the multi-level menu */
{
font: bold 14px Arial, Helvetica, sans-serif;
color: #FFFFFF;
text-decoration: none;
padding: 0 0 0 10px;
/* Make the link cover the entire list item-container */
display: block;
line-height: 30px;
}
ul#top-level-menu a:hover { color: #000000; }
我有 JS(文件名:Menu-Script.js)
document.getElementById("nav01").innerHTML =
"<ul id='top-level-menu'>" +
"<li><a href='index.html'>Home</a>" + // not close li here
"<ul id='second-level-menu'>" +
"<li><a href='index12.html'>Home12</a>" + // not close li here
"<ul id='third-level-menu'>" +
"<li><a href='index123.html'>Home123</a></li>" +
"<li><a href='index124.html'>Home124</a></li>" +
"</ul></li>" + // close li here
"<li><a href='index13.html'>Home13</a></li>" +
"</ul></li>" + // close li here
"<li><a href='customers.html'>Data</a></li>" +
"<li><a href='about.html'>About</a></li>" +
"</ul>";
document.getElementById("foot01").innerHTML =
"<p>© " + new Date().getFullYear() +
" OKay..</p>";
【问题讨论】:
标签: javascript html css drop-down-menu internet-explorer-11