Jump to content

Recommended Posts

Posted

i need a form that someone can fill out, and which will then redirect them to another page which displays stuff (or not) dependant on the way that they filled out the form.

 

I also need the form to save its data using GET, so that the URL can be copied and passed to someone else, who can then view the page.

 

In other words, i need a form that will allow someone to 'customise' a webpage for someone else.

 

now... i can't play about with any server-side gubbins; the only way i can conditionally display stuff is using javascript.

 

which i dont know :-(

 

i've got as far as figuring out stuff like

 

<script type="text/javascript">
if (variable1 == yes)
(
document.write ("you chose variable one")
)
</script>

 

but the thing that i can't figure out is how to grab the GET data that is stored in the URL using javascript? I've googled about for ages, and can't find it anywhere.

 

if anyone knows how to do this, i'd greatly appreciate it if they would tell me :)

Posted

there's no easy way to do it?

 

poop.

 

still... i've just discovered the 'split' thing, and i'm having fun :) i've allready managed to get one of the GET thingies.

 

<h3>Hello<script type="text/javascript">
var url = window.location.href
var url2 = url.split("?")
var username = url2[1]
var username2 = username.split("=")
if (username2[0] == "username")
{
var username3 = username2[1]
var username4 = username3.split("&")
document.write (" " username4[0])
}
</script>, and welcome...</h3>

 

(i know the last document.write bit's wrong btw)

 

whilst kinda fun, this strikes me as the long way of doing this, and i think the fun's going to evaporate as soon as i get onto the rest of the GET data :-(

Posted

Yes, that's the only way to do it.

 

You could always wrap it in a function though and let that do all the dirty work for you :)

 

Cheers,

 

Ryan Jones

Posted

man, i finally did it.

 

that was such a pain in the arse.

 

cheers both.

Posted

it's on this page ;)

 

There's another page that generates the url.

 

(theyre just demos of an idea atm)

 

it wasn't actually that hard in the end, just very confusing :D

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

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.