Change Text When Going to Previous Page

iboware

New Member
I have made a website where, upon choosing an item in the menu bar, the screen moves to a specific spot on the page. I then made a function in which the text changes in two spots, "titletext" and "infotext". Example:\[code\]<li><a href="http://stackoverflow.com/questions/12771765/#content" onclick='changeText()'>Weeee!</a></li>\[/code\]It works but now I realize I have a problem: When I choose to go back to the previous page, the text remains the same, until the user chooses to refresh the page.Using Javascript, how can I tell the website to change the text when (for example) the page is on \[code\]#content\[/code\] and change the text again when it's on the home page? Do I have to take a different approach with my code?Below is my code for changeText():\[code\]function changeText(){ document.getElementById('titletext').innerHTML = 'Mission Statement'; document.getElementById('infotext').innerHTML = 'RANDOMTEXT';}\[/code\]EDIT: Here's an example of what I want my website to do. \[quote\] When the user hits the back button on the browser, the text changes to the previous text. So if it shows "Hey" then it shows "Bye", when the user hits the browser's back button, the code changes to "Hey"\[/quote\]
 
Back
Top