Jump to content

Archived

This topic is now archived and is closed to further replies.

Lorian

How to get part of the URL

Recommended Posts

Say the URL of the page the JavaScript is on is http://example.com/somepage.php?id=7, how would I get the 7 from the URL using JavaScript? Cheers.

Share this post


Link to post
Share on other sites
If you go to my website http://www.nogray.com and download the JS library. You can access all the URL variables by including the base.js file.

after you downloading the zip file, you'll need to include this in the header
[code]
<script language="javascript" src="nogray_lib/base.js" type="text/javascript"></script>
<script language="javascript" defer src="nogray_lib/IE_loader.js" type="text/javascript"></script>
[/code]

and your script will access the id by
[code]
_GET['id'];
[/code]

Here is a link to all the base.js functions
http://www.nogray.com/phpbb/viewforum.php?f=2

Here is where you can download it.
http://www.nogray.com/new_site/download.php

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.