onclick problem in IE6

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
This works fine in Firefox, but not in IE (at least not in IE6).

I have a select box called "S".

I have two hidden fields H1 and H2 which contain the contents (all the
<option value=?">text</option>) stuff for two different conditions.

I have two radio button, each of which has an onclick event.  They are

for R1:
onclick="document.getElementById('S').innerHTML =
        document.getElementById('H1').value"                  <input
type="hidden" id="byName" value='<option value="0">-- View Our Services
--</option><option value="1">Rafael Monterrey - Real Estate</option>' />
                   <input type="hidden" id="byProf" value='<option
value="0">-- View Our Services --</option><option value="1">Real Estate
- Rafael Monterrey</option>' />


for R2:
onclick="document.getElementById('S').innerHTML =

In IE6 I get empty sets after the first click to change the radio
buttons setting (from R1 to R2) and thereafter.  In FF, it works like a
charm.  The event must be firing or I wouldn't go from the initial set
to empty on the first click.  Why would IE get a null for the values of
the hidden fields while FF does not?  (A view source shows that the
hidden fields are properly filled).

Any ideas?

Re: onclick problem in IE6

On or about 9/20/2008 14:50, it came to pass that sheldonlg wrote:
Quoted text here. Click to load it

It's a problem with IE. To fix it put a span around the select, then
change the innerhtml of the span. Include the full select html. It works
in all browsers for me. YMMV

<span id='SomeSel' style='display:none'>
<select name='Some_Week' >
<option value="">Week</option>
<option value="1st">1st</option>
<option value="2nd">2nd</option>
<option value="3rd">3rd</option>
<option value="4th">4th</option>
<option value="last">Last</option>

JavaScript to change it
document.getelementbyid('SomeSel').innerhtml =
'<select name='Some_Week' >
<option value="">Week</option>
<option value="5th">5th</option>
<option value="6th">6th</option>
<option value="7th">7th</option>
<option value="8th">8th</option>

Re: onclick problem in IE6

totalstranger wrote:
Quoted text here. Click to load it

Thanks.  I was only setting the innerHTML of the select.  Go know that
you have to have even the specification of the select in the innerHTML
to satisfy (UGH!) IE.

I worked my way around this is a similar manner.  I specified two
selects, one ordered one way and the second another way.  I made the
first one display:'' and the second display:none.  The two radio buttons
  just toggle the display properties between the two.  Crude, but it works.

Site Timeline