Ich muss ein Dropdown-Menü von "menu4" auf den Code unten. Der Code läuft gut, aber ich muss ein Dropdown-Menü einführen. Ich habe verschiedene Möglichkeiten ausprobiert, um eine Liste in einer Liste zu haben, aber scheint nicht zu funktionieren. Ich brauche wirklich jemand Hilfe. Jemand? Vielen Dank. Wie mache ich Drop-Down-Menü von document.getElementById Javascript
document.getElementById("nav01").innerHTML =
"<ul id='menu'>" +
" <li><a href= '#'>Home</a></li> " +
" <li><a href= '#'>menu1</a></li> " +
" <li><a href= '#'>menu2</a></li> " +
" <li><a href = '#'>menu3</a></li> " +
" <li><a href = '#'>menu4</a></li> " +
" <li><a href = 'index.php'> Log Out</a></li> " +
"</ul>";
body {
font-family: Bookman Old Style;
font-size: 13px;
background-color:#EBF4FA;
color: #696969;
padding-right: 150px;
padding-left: 150px;
}
#top{
background-color: ;
height: 120px;
box-shadow: 10px #888888;
}
#main {
padding: 5px;
padding-left: 15px;
padding-right: 15px;
background-color: #EBF4F4;
border-radius: 0 0 5px 5px;
border-style: solid;
border-right-width: 1px;
}
h3 {
font-family: Bookman Old Style;
border-bottom: 3px;
color: black;
font-size: 16px;
}
table {
width:100%;
}
table, th , td {
border: 1px solid white;
border-collapse: collapse;
padding: 0px;
}
th {
text-align: left;
}
table tr:nth-child(odd) {
background-color: #ffffff;
}
table tr:nth-child(even) {
background-color: #ffffff;
}
ul#menu {
padding: 0;
margin-bottom: 11px;
}
ul#menu li {
display: inline;
margin-right: 3px;
margin: 100px auto;
line-height:30px;
max-width:860px;
}
ul#menu li a {
background-color: #ffffff;
padding: 10px 20px;
text-decoration: none;
color: #696969;
border-radius: 4px 4px 0 0;
}
ul#menu li a:hover {
color: white;
background-color: black;
}
#footer {
position: right;
color: #ffffff;
}
h1 {
border-bottom: 3px solid orange;
font-size: 30px;
}
<!DOCTYPE html>
<html>
<head>
<title>About</title>
<link href="site.css" rel="stylesheet">
</head>
<nav id="nav01"></nav>
<body>
<div id="main">
<h1>About Us</h1>
<p>Dibon Company Limited is a project delivery and technical consultancy firm that provides efficient and cost effective methodologies and expertise in managing complex as well as simple projects</p>
<div class="box contactdetails">
<h2>Our Contact Details </h2>
<ul>
<li>Dibon Limited Company</li>
<li class="last">Website: <a href="https://www.dibon.co.ke">dibon</a></li>
<li>Email: [email protected]</li>
<li class="last">Facebook: <a href="https://web.facebook.com">Dibon</a></li>
</ul>
</div>
</div>
<script src="script.js"></script>
</body>
</html>
anstatt dies 'ma zu tun Wie wäre es mit der Verwendung der Templating-Funktion eines Frameworks wie angular.js, um den Dropdown-HTML-Code aus Daten zu generieren? – CodeToad