Variables from the URL

They have: 56 posts

Joined: Feb 2000

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's picture

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's picture

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.