Hi
This is for a simple web-page assignment. I have a few pages on which I would like to display the same list of links in a sidebar and so have made the following javascript:
document.getElementByid('list').innerHTML = '<a href=\"index.html\">Main Page</a>'+
'<a href=\"benefits.html\">Benefits</a>'+
'<a href=\"facts.html\">Shocking Statistics</a>'+
'<a href=\"links.html\">Resources</a>';
I then added this into the top of the page using:
<head>
<script type="text/javascript" src="./script/links.js"></script>
</head>
...
<div id="list">
</div>
But the problem is that the links don't appear and I fear I may have to go back to using too many document.write
lines.