I want to have one navigation bar/menu for all my web pages.
I found one solution for that problem (one menu/navbar for alla web pages). Someone had the same problem her, and I used one member’s answer that worked just fine. The solution was to make a javascript imbedded code. The problem is that I don't know how to make a submenu in javascript. I have tried but not succeeded. Can someone tell me how to modify the javascript code? I would be very happy if someone could help me. I used the following code:
script.js
document.getElementById("navMenu").innerHTML =
'<ul>'+
'<li><a href="index.html">Home</a></li>'+
'<li><a href="services.html">Services</a></li>'+
'<li><a href="about.html">About</a></li>'+
'</ul>';
index.html
<body>
<nav id="navMenu"></nav>
<div> rest of web page body here </div>
<script src="script.js"></script>
</body>
about.html
<body>
<nav id="navMenu"></nav>
<div> rest of web page body here </div>
<script src="script.js"></script>
</body>