Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: Checkbox object returning a html page with the use of onClick or onSubmit


Message #1 by "Meish Haynes" <meishh@h...> on Tue, 28 Jan 2003 21:45:09
	Well, that would depend on how you design those html files names.
You can have up to 16 possible combinations.  Do they have some
structural/systematical names, or just names based on their usage?

	In case their names are according to usage, maybe you can make use
of associative array, something like this:

var filegroups =3D new Object()
filegroups.f0001 =3D "company.html"
filegroups.f0101 =3D "support.html"
filegroups.f1001 =3D "download.html"
......

var f =3D document.form_name

var c0 =3D (f.checkbox0.checked) ? "1" : "0"
var c1 =3D (f.checkbox1.checked) ? "1" : "0"
var c2 =3D (f.checkbox2.checked) ? "1" : "0"
var c3 =3D (f.checkbox3.checked) ? "1" : "0"

var thepage =3D filegroups["f " + c0 + c1 + c2 + c3]

HTH

> -----Message d'origine-----
> De : Meish Haynes [mailto:meishh@h...]
> Envoy=C3=A9 : mardi 28 janvier 2003 22:45
> =C3=80 : javascript
> Objet : [javascript] Checkbox object returning a html page
> with the use
> of onClick or onSubmit
>
>
> I am trying to use checkboxes to collect data from a user.
> When the user
> clicks an option and clicks the submit button I want it to
> return a html
> page.  Depending on the number of choices the user picks I want it to 

> return a different html page for each option when the user
> clicks submit. 
> I have 4 checkboxes with different values and the user can check any
> combination of the boxes and get a different html page for each
> combination when they click on the submit button.
>
> Please help!
>
> Thanks very much for your help!!!!!!!!

  Return to Index