Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Client Side Javascript that works like ASPs QUERYSTRING

Status
Not open for further replies.

CamaroLT

Programmer
Joined
Dec 16, 2002
Messages
159
Location
CA
I'm in the process of redeveloping a company web site. Unfortunately, I don't have access to a database, or an ASP/PHP engine to play with, so, I'm stuck with static HTML pages.

One of the things I'm trying to do is have one HTML page that shows one particular picture, and shows a BACK button. It would show different images via whatever file I put into the URL.

My question is, is there anything in JavaScript that will let me read whats in the URL, similar to how ASPs QueryString works?

-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=
NEVER send the boss to do a techs job
 
Yes, you can read the URL like this:
Code:
var URL = location.href;
This saves the entire URL as a string and from there you can split and parse it as you wish.

Lee
 
My question is, is there anything in JavaScript that will let me read whats in the URL, similar to how ASPs QueryString works?

absolutely

Code:
var url = String(document.location);

then use javascript's built in string methods to extract the data you need:


-kaht

[small]How spicy would you like your chang sauce? Oh man... I have no idea what's goin' on right now...[/small]
[banghead]
 
Not even up for 5 minutes and BANG, get not one, but two working replies. :) Thanks. Appreciated, and the functions are working perfectly.

-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=
NEVER send the boss to do a techs job
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top