Click to See Complete Forum and Search --> : object.remove
AdamBrill
02-08-2003, 08:23 PM
Can someone show me a simple code example of object.remove? I found it on MSDN, but they didn't have any code example and it wouldn't work how they said... I want to use it with a <SELECT> tag. Here's a link to the MSDN site: http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/methods/remove.asp
Dan Drillich
02-08-2003, 08:53 PM
One way to trim a select list is by reducing its length property.
<FORM name="form1">
<SELECT name="menu1">
<OPTION selected>-- select --</OPTION>
<OPTION value="http://google.com">Google</OPTION>
<OPTION value="http://excite.com">Excite</OPTION>
</SELECT>
<SCRIPT language="JavaScript">
var engines = document.form1.menu1;
engines.options.length = 2;
</SCRIPT>
</FORM>
AdamBrill
02-08-2003, 09:10 PM
hmm... That would work, except that I can only take out the last one. Is there some way to take out one that is in the middle? Like, in your example, take out the Google one rather than the Excite one? Any ideas?
Dan Drillich
03-03-2003, 05:20 PM
The following line will take out the Google option -
engines.options[1] = null;
A bit late, sorry :)