S
Ssthisto
I'm not terribly experienced in Javascript - I know how to make an
array and what the syntax is for a document.write, but that's about it
- I'm not familiar with Javascript and the use of forms other than the
Submit button...
What I'm wondering is if it's possible, when writing a form, to make
each individual radio button group set a variable that Javascript can
use to reference to a web page.
Basically, I'm writing a 'what pet is best for you' quiz, and have
questions like
What size do you feel most comfortable with:
() Tiny
() Small
And so on. I want to be able to set the radio button value 'tiny',
say, equal to a javascript variable - var Size = "1" (And 'Small' to
be var Size = "2" )for example, and to have different variables for
each question. I'm not so worried about typing in repeating code over
and over just changing the variable names.
Once the questions are all answered and the submit button's pressed,
I'd want to be able to do a document.write that referred to the
numerical values of the variables set by the questions, something like
document.write ("<a href='http://www.blah.com/quiz/" + Size + Colour +
This + That + TheOther + ".htm'>Your Best Pet Choice</a>")
so that depending on the radio buttons checked, you could wind up with
X or Y or Z. Is this possible, and does anyone know of a relatively
easy-for-a-newbie way to do it?
Thanks!
- Ssthisto
array and what the syntax is for a document.write, but that's about it
- I'm not familiar with Javascript and the use of forms other than the
Submit button...
What I'm wondering is if it's possible, when writing a form, to make
each individual radio button group set a variable that Javascript can
use to reference to a web page.
Basically, I'm writing a 'what pet is best for you' quiz, and have
questions like
What size do you feel most comfortable with:
() Tiny
() Small
And so on. I want to be able to set the radio button value 'tiny',
say, equal to a javascript variable - var Size = "1" (And 'Small' to
be var Size = "2" )for example, and to have different variables for
each question. I'm not so worried about typing in repeating code over
and over just changing the variable names.
Once the questions are all answered and the submit button's pressed,
I'd want to be able to do a document.write that referred to the
numerical values of the variables set by the questions, something like
document.write ("<a href='http://www.blah.com/quiz/" + Size + Colour +
This + That + TheOther + ".htm'>Your Best Pet Choice</a>")
so that depending on the radio buttons checked, you could wind up with
X or Y or Z. Is this possible, and does anyone know of a relatively
easy-for-a-newbie way to do it?
Thanks!
- Ssthisto