JavaScript and AJAX Forum

Having fun and games - basically have form with javascript to show options concealed in DIV's when drop down clicked. Works fine in Firefox but in IE does not show div's when in IE. After 6 hours, I'm losing it ! Here's the complete code showing the javascript and the form code :

When I use the same structure but with radio buttons instead of a dropdown it works fine, so I presume the problem is in the drop down option "onclick" command. Any help would be greatfully appreciated.

try using 'onchange', rather than 'onclick'. i've got a select form on my site too, which redirects users to different places, and i use onchange="this.form.submit()" on the select tag, which works okay.

Thanks Demaestro - I've tried using this but still to no avail. Question, have I formatted the option part of the form correctly as so - <option value="Platinum 2 seater fabric sofabed:539"onblur="Display('phone')";>2 seater fabric sofabed</option> <option value="Platinum 2 seater fabric fixed sofa:499"onblur="Display('email')">2 seater fabric fixed sofa</option>

First, I don't know why you are using "phone" and "email" for your values. The values have nothing to do with phone or email. Examine this, understand how and why it works . . . . I suggest adding another parameter to your options to represent the show/hide ID, as they are already colon delimited. Use JS to grab the last value. In your PHP you can just do an explode and pop it off the array, which effectively "throws it away."

Note also that this approach allows expandability of the number of show/hide divs you can have by just expanding the divs array:

var divs = Array('p1-div','p2-div','p3-div','p4-div');

If this works for you, remove the containing div (changed to paragraph in my sample,) assign the ID directly to the select. Less is more. :-)

Finally adapted Rocknbil's script above into my webpage. Here's the page with the form script working in the product order box, bottom right of page. One question if anyone could help ? Is it possible to add multiple values in the 'option value' field of the form select, for example - <option value="Platinum 2 seater fabric sofabed:539:p1-div,p2-div,p3-div">2 seater fabric sofabed</option> ... so resulting in all three divs showing when this option selected ? Thanks in advance for any help on this one. Chris