Yeah. And if I were you i woild use
document.myForm.mySelect.style.display =3D "none" to hide the objects
and document.myForm.mySelect.style.display =3D "" to show the objects.
Why, you might wonder. Because visibility just hides the object while
the space on the htmldocument is still allocated for the object. Display
on the other hand hides the object and remove the space that were
allocated for it.
-----Ursprungligt meddelande-----
Fr=E5n: Kyle Ketterer [mailto:bige88fan@c...]
Skickat: den 12 november 2002 06:43
Till: professional php
=C4mne: [pro_php] Re: Java/PHP Question
Ok, so I would add a onchange=3D\"\" tag to the select box right? So it
would
say onchange=3D\"myfunction();\"
?
Thanks,
-Kyle.
----- Original Message -----
From: "jorge" <jorge@d...>
To: "professional php" <pro_php@p...>
Sent: Monday, November 11, 2002 6:44 PM
Subject: [pro_php] Re: Java/PHP Question
> Hi Bill:
>
> I am giving you a couple of ideas
> place your select boxes where you want then to appear all hidden use a
> function like the following to show them
>
> function myfunction()
> {
> var xxx =3D eval(document.myForm.mySelect.value);
> switch(xxx)
> {
> case "category_one":
> document.myForm.mySelectSubcategoryOne.style.visibility
=3D
> "visible";
> break;
> case "category_two":
> document.myForm.mySelectSubcategoryTwo.style.visibility
=3D
> "visible";
> break;
> defautl:
> }
> }//function ends
> another idea is all the option tags are part of the options array
> so you can have your select box of subcategories visible but you can
have
> hidden all the options
> then run a similar function just to make visible
> case "category_one":
> for(i=3D0;i<MySetvalue1;i++)
> {
> document.myForm.mySelectSubcategoryTwo.options[i].style.visibility =3D
> "visible";
> }
> break;
> case "category_two":
> for(i>MySetvalue1;i<MySetvalue2;i++)
> {
> document.myForm.mySelectSubcategoryTwo.options[i].style.visibility =3D
> "visible";
> }
>
> Hope this helps you if not send me the code to do it
>
> Jorge
> :)
>
> ----- Original Message -----
> From: "Bill" <bige88fan@c...>
> To: "professional php" <pro_php@p...>
> Sent: Monday, November 11, 2002 7:36 PM
> Subject: [pro_php] Re: Java/PHP Question
>
>
> > Ok, I understand that now...But the main thing I need to know is how
the
> > actual function is performed in javascript. Like, I need the
function to
> > send the <option></option> which will be stored in the javascript
function
> > to be sent to the "subs" select box when somebody selects the like
parent
> > category. Anybody know? Thanks,
> >
> > -Kyle.
> >
> >
> >
> >
> >
> > > I will use the onChange event to change the visibility property i
have
> > done
> > this Believe it or not to avoid the form to be submited twice just
for
> fun.
> > you can have your elements.visibility set to false that means all of
your
> > select are hidden use an if or swhitch to see which one to show
> >
> > Jorge
> >
> > ----- Original Message -----
> > From: "Bill" <bige88fan@c...>
> > To: "professional php" <pro_php@p...>
> > Sent: Monday, November 11, 2002 5:07 PM
> > Subject: [pro_php] Java/PHP Question
> >
> >
> > > This question involves the use of java in form manilpulation with
the
> use
> > > of PHP. I don't java THAT well, but I know some. I searched the
net
for
> a
> > > java function that could do what I wanted, but couldn't find one:(
So
I
> > > come here again:) Anyways what I want to do is have a form select
box
> > > display a list of categories in another select box(in <option>
form of
> > > course) when I select what parent category. Basically this is a
mini-
> > > layout of what I need to do:
> > >
> > > <form action=3D\"bla.php\" method=3D\"post\">
> > > <select name=3D\"main\">
> > > <option value=3D\"Sports\" onClick=3D\"Sports(this.form>\">
> > > <option value=3D\"Trading\" onClick=3D\"Trading(this.form)\">
> > > </select>
> > >
> > > Ok, you see above that I have 2 MAIn categories, now I want to
display
> > the
> > > sub-categories which will already be stored in the java function
after
I
> > > know what IT is lol
> > >
> > > I want to display the result sub-categories in this select box
below:
> > >
> > > <select name=3D\"subs\">
> > > </select>
> > >
> > >
> > > Here is the java function that I found, but I don't know if it can
> > help...
> > > <SCRIPT LANGUAGE=3D"JavaScript">
> > > function Sports(form) {
> > > var TestVar =3D form.subs.SelectedIndex;
> > >
> > > I WANT TO WRITE a couple <option></option> to the subs select box
here!
> > >
> > > }
> > > </script>
> > >
> > > Understand what I'm trying to do? When a user clicks on the
"Sports"
> > > or "Trading" option in the "main" select box, I want to display
it's
> sub-
> > > categories using *some* javascript functions? Can anybody help?
> > >
> > > Thanks,
> > >
> > > -Kyle.
> > >
> > >
> > >
> > >
> > >
> > >
> > > }
> > > </SCRIPT>
> >
> >
>
>
>
>