I feel there is such an easy answer to this, but my google-fu is failing me. What I currently have are several links that once clicked, change the HTML content in a DIV.
<a href="#new" onclick="document.getElementById('body').innerHTML
= '<p>NEW</p>';">NEW!</a>
But I want to be able to link to this content. Is there anyway to link to this by going to a URL such as http://www.blahblah.com/index.html#new so it auto-loads the new HTML code?
Forgive me if I’m an idiot… I’m fairly new to javascript.
You can use window.location.hash to see what the hash is on the URL and show the correct DIV based on that. Assuming all your divs are on the page, once you know the div you want to show you would do something like this:
Small example: