GetDotted Domains

Viewing Thread:
"JavaScript Query"

The "Freeola Customer Forum" forum, which includes Retro Game Reviews, has been archived and is now read-only. You cannot post here or create a new thread or review on this forum.

Wed 02/04/03 at 13:55
Regular
Posts: 787
I'm sure it is, but can't remember how :)

I'm after a little bit of code that can take in any query string from the Web Address, and store it as a normal variable, ready for use in the script.

For example: index.php?User=Chris&Age=20

I'd like to be able to get the info from User (in this case, Chris) and be able to use it in the script.

Can anyone shed some light onto the possible code??

I know PHP would do this in a sinch, but this particular host doens't have PHP.

Thanks :).
Wed 02/04/03 at 16:01
Regular
"It goes so quickly"
Posts: 4,083
Wicked, thanks for that :)

I owe you one.
Wed 02/04/03 at 16:00
Regular
"You've upset me"
Posts: 21,152
So the script would then be...

Wed 02/04/03 at 15:58
Regular
"You've upset me"
Posts: 21,152
I've done it for you :-D



to split the url it would just be:

var urlsplit=location.href.split('/')

urlsplit[1] would then be what I've defined as string above.

:-D
Wed 02/04/03 at 15:47
Regular
"It goes so quickly"
Posts: 4,083
Oh yeah, forgot to ask :)

How would I implement the split() function to get the Site Address ... is there a pre-defined var for the address the browser is currently at??

eg:
var this_site = doccument.url;
an_array = split(this_site);
????

Thanks :)
Wed 02/04/03 at 15:45
Regular
"It goes so quickly"
Posts: 4,083
split(), thats a built in JavaScript function, correct??

Thanks I'll give that a go.

Hidden Inputs could work, but I'd prefer using Text Links rather than Form Buttons.
Wed 02/04/03 at 15:29
Regular
"You've upset me"
Posts: 21,152
In fact, you could just split it at the = and do one more split at the & to remove that part and Robert's your mother's brother.
Wed 02/04/03 at 15:27
Regular
"You've upset me"
Posts: 21,152
You could also take the address and use split() on it then set variables to the array.

var name=address[4] or whatever. Would take some working out to narrow the split down to the name and age but it would work. As M_m said, a bit clunky but it'll do what it needs to.
Wed 02/04/03 at 14:00
Regular
"Pouch Ape"
Posts: 14,499
i.e.

Address given is: index.php?name=Chris&age=20

Hidden input forms on page:






These are filled with the values, then use Javascript:



That should work.
Wed 02/04/03 at 13:57
Regular
"Pouch Ape"
Posts: 14,499
Can't you set hidden input boxes and then use functions to take the values from the boxes as the page loads? A bit clunky, but it should work.
Wed 02/04/03 at 13:55
Regular
"It goes so quickly"
Posts: 4,083
I'm sure it is, but can't remember how :)

I'm after a little bit of code that can take in any query string from the Web Address, and store it as a normal variable, ready for use in the script.

For example: index.php?User=Chris&Age=20

I'd like to be able to get the info from User (in this case, Chris) and be able to use it in the script.

Can anyone shed some light onto the possible code??

I know PHP would do this in a sinch, but this particular host doens't have PHP.

Thanks :).

Freeola & GetDotted are rated 5 Stars

Check out some of our customer reviews below:

Great services and friendly support
I have been a subscriber to your service for more than 9 yrs. I have got at least 12 other people to sign up to Freeola. This is due to the great services offered and the responsive friendly support.
Thank you very much for your help!
Top service for free - excellent - thank you very much for your help.

View More Reviews

Need some help? Give us a call on 01376 55 60 60

Go to Support Centre

It appears you are using an old browser, as such, some parts of the Freeola and Getdotted site will not work as intended. Using the latest version of your browser, or another browser such as Google Chrome, Mozilla Firefox, or Opera will provide a better, safer browsing experience for you.