Here's how I do it:<br><br> while (drpBox.length){<br> drpBox.remove(0);<br> }<br><br>Milo<br><br><div><span class="gmail_quote">On 2/1/06, <b class="gmail_sendername">Andrew Crawford</b> <<a href="mailto:javascript@evermore.com">
javascript@evermore.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">It works in Firefox, Opera, and Safari, too.<br>
<br>I'm curious whether there is a good reason not to do it this way<br>(setting length to 0).<br><br>Andrew Crawford<br><br>James Conley wrote:<br>> Oddly enough this works in IE - does it work in other browsers as well?
<br>> Normally .length is read-only for arrays and such.<br>><br>><br>> james c<br>><br>><br>><br>> ------------------------------------------------------------------------<br>> *From:* <a href="mailto:javascript-bounces@LaTech.edu">
javascript-bounces@LaTech.edu</a><br>> [mailto:<a href="mailto:javascript-bounces@LaTech.edu">javascript-bounces@LaTech.edu</a>] *On Behalf Of *Peter Brunone<br>> *Sent:* Wednesday, February 01, 2006 10:53 AM<br>> *To:*
<a href="mailto:javascript@LaTech.edu">javascript@LaTech.edu</a><br>> *Subject:* Re: [Javascript] deleting all options<br>><br>> Can you still set options.length = 0?<br>><br>> Also, innerHTML = "" comes to mind (this might possibly be fastest,
<br>> though not supported by earlier browsers)...<br>><br>> Peter<br>><br>> *From*: "Nick Fitzsimons" <a href="mailto:nick@nickfitz.co.uk">nick@nickfitz.co.uk</a> <mailto:<a href="mailto:nick@nickfitz.co.uk">
nick@nickfitz.co.uk</a>><br>><br>>> i dynamically fill a .<br>>> when i do it twice the first created options still are in the new select.<br>>><br>>> now i need ans easy function to clear the
<br>> you can use<br>><br>> // get reference to element<br>> var element = document.getElementById("mySelect");<br>> // remove all children of element<br>> while (element.firstChild) {<br>>
element.removeChild(element.firstChild);<br>> }<br>><br>> As you presumably already have a variable reference to the select, adjust<br>> accordingly.<br>><br>> The while loop there is a general purpose way of removing all the child
<br>> nodes of any element, so depending on your needs, you may find it useful<br>> to move it into a function.<br>><br>> HTH,<br>><br>> Nick.<br>> --<br>> Nick Fitzsimons<br>> <a href="http://www.nickfitz.co.uk/">
http://www.nickfitz.co.uk/</a><br>><br>><br>> ------------------------------------------------------------------------<br>><br>> _______________________________________________<br>> Javascript mailing list
<br>> <a href="mailto:Javascript@LaTech.edu">Javascript@LaTech.edu</a><br>> <a href="https://lists.LaTech.edu/mailman/listinfo/javascript">https://lists.LaTech.edu/mailman/listinfo/javascript</a><br>_______________________________________________
<br>Javascript mailing list<br><a href="mailto:Javascript@LaTech.edu">Javascript@LaTech.edu</a><br><a href="https://lists.LaTech.edu/mailman/listinfo/javascript">https://lists.LaTech.edu/mailman/listinfo/javascript</a><br>
</blockquote></div><br>