Forum Moderators: open
[webmasterworld.com...]
BlobFisk: What jbhavin is trying to achieve is to take the filename from the URL and write it to the page.
And there's also a reference to the code found here:
[webmasterworld.com...]
So if you must use javascript, first know that all js information is tied to the page itself, and every time the user loads the new page, the previous page's js variables and functions are re-set.
The only way I know to pass information to the next page with javascript is to add the needed data as a query string that is appended to the URL. Then javascript on the next page can read the url and extract the data from the query string.
You'll need to add something like this --?thispage.html -- to the end of every internal link on the page. You can do this manually within each anchor tag, or you can script it. So your link from abc.html to xyz.html will end up looking like this:
<a href="xyz.htm?abc.html">XYZ</a>
Then on xyz.htm you can use javascript to pull that information from the query string with a function like this:
thisURL = parent.document.URL
previousURL = thisURL.substring(thisURL.indexOf('?')+1, thisURL.length)