Variables from the URL
Wow. I haven't been here in a while. The site looks way different now!
Anyway, lets say I click on a link and the url is page.html?name=Rageforth&age=21. Then it goes to page.html. How can I get the variables (name and age) from the URL and display it on the page?
The trouble with doing something right the first time is that nobody appreciates how difficult it was.
AndyB posted this at 01:06 — 19th January 2001.
They have: 344 posts
Joined: Aug 1999
<script type="text/javascript">
var1 = location.search.substr(1).split("=")
var2 = location.search.substr(2).split("=")
</script>
splits the URL at each occurrence of "=" in the string
Jack Michaelson posted this at 13:25 — 22nd January 2001.
He has: 1,733 posts
Joined: Dec 1999
Or use ASP.
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.