Hi Ben,
I do the same. I guess this bug goes so far back that this method is just
second-nature to me. Sorry Beverly if I mislead you earlier by my previous
statements.
Alternatively, for those wanting to remove an option, you just set the option
to null. But of course when removing all the options for a select you should
loop from the bottom up so the index doesn't change.
Something like so:
for(var i = (v_list.length - 1); i >= 0; i--){
v_listExport.options[i] = null;
}
I guess the bug stems from the fact that the MSIE parsing engine renders all
Select drop-downs as independent browser objects (an actual Window), which
makes scripting accessibility more than a little complicated internally. This
little feature is why selects are visible sometimes when "layering" other HTML
objects over a select, for MSIE 6 and earlier.
Oh well, whoever said programmers or software were perfect?
Scott,
On Monday, October 29, 2007 4:14pm, Ben Johansen <[EMAIL PROTECTED]> said:
> humm, I have never used innerHTML with select options, I always reset
> the options like this from return from AJax
>
> example:
> <pre>
> var SelectObj =
> document.getElementById('eventcategories');
> SelectObj.options.length = 0
> for (j=0;j<newLen;j++)
> {
> var vNewValue = rowid[j]+'|'+eventKey;
> var vNewText = category[j]+'
> ('+imgcount[j]+')';
> SelectObj.options[j] = new
> Option(vNewText,vNewValue);
> }
> SelectObj.selectedIndex = -1;
> </pre>
> Ben
>
> On Oct 29, 2007, at 11:23 AM, Beverly Voth wrote:
>
> On 10/29/07 12:51 PM, "Ben Johansen" <[EMAIL PROTECTED]> wrote in
> whole or in
> part:
>
>> Right, tho, most of my code hovers in a JS block just above the </
>> body>
>> because sometimes if you place it just after the tag, and that tag is
>> in let say a <form></form> sometimes a wrapper tag can get in the way
>>
>> Im going to have to look into more the innerHTML thing under IE7,
>> like Scott said your mileage may vary, and I have not gotten a flat
>> tire from this nail ;-)
>
> I found this relating to select (option)
> <http://alexle.net/archives/150>
>
> And more links when you Google "innerHTML and IE 7".
> Beverly
>
>> Ben
>>
>>
>> On Oct 29, 2007, at 9:43 AM, Beverly Voth wrote:
>>
>> On 10/29/07 12:25 PM, "Ben Johansen" <[EMAIL PROTECTED]> wrote in
>> whole or in
>> part:
>>
>>> also most of my JS code is placed after the object, because IE
>>> doesn't let you access the object from JS until it is there.
>>
>>
>> Can you give an example? Like this, eh (script *after* the id it
>> calls)?
>>
>> <div id="abc">
>> </div>
>>
>> <script type="text/javascript">
>> function dosomething() {
>> var myobj = document.getElementById("abc").innerHTML;
>> ....
>> }
>> </script>
>
> ________________________________________________________________________
> TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf
>
> ________________________________________________________________________
> TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf
>
>
________________________________________________________________________
TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf