Lorian Posted July 27, 2006 Share Posted July 27, 2006 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. Link to comment https://forums.phpfreaks.com/topic/15830-how-to-get-part-of-the-url/ Share on other sites More sharing options...
nogray Posted July 27, 2006 Share Posted July 27, 2006 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 functionshttp://www.nogray.com/phpbb/viewforum.php?f=2Here is where you can download it.http://www.nogray.com/new_site/download.php Link to comment https://forums.phpfreaks.com/topic/15830-how-to-get-part-of-the-url/#findComment-64801 Share on other sites More sharing options...
Lorian Posted July 27, 2006 Author Share Posted July 27, 2006 That worked good, thanks. Link to comment https://forums.phpfreaks.com/topic/15830-how-to-get-part-of-the-url/#findComment-64804 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.