Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 05-04-2008, 04:20 AM   PM User | #1
WebmasterLULZ
New Coder

 
Join Date: Mar 2008
Posts: 61
Thanks: 2
Thanked 0 Times in 0 Posts
WebmasterLULZ is an unknown quantity at this point
Exclamation Get URL Parameters Using Javascript

So what I need to do is pretty much say

"If &type=1 is at the end of document.URL than do this function .. if &type=1 ISNT in the URL ... than do something else" (kinda like if/else)

Last edited by WebmasterLULZ; 05-04-2008 at 04:54 AM..
WebmasterLULZ is offline   Reply With Quote
Old 05-04-2008, 10:57 AM   PM User | #2
Philip M
Supreme Master coder!

 
Philip M's Avatar
 
Join Date: Jun 2002
Location: London, England
Posts: 17,044
Thanks: 197
Thanked 2,412 Times in 2,390 Posts
Philip M has a spectacular aura aboutPhilip M has a spectacular aura aboutPhilip M has a spectacular aura about
Code:
var theURL = window.location;  // or var theUrl = document.URL;
if (/(&type=1)$/i.test(theURL)) {  // returns true if ends in &type=1
dothis();
}
else {
dothat();
}
"I cannot conceive that anybody will require multiplications at the rate of 40,000 or even 4,000 per hour ..." -- F. H. Wales (1936)

Last edited by Philip M; 05-04-2008 at 11:07 AM..
Philip M is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:13 PM.


Advertisement
Log in to turn off these ads.