Javascript List box Option removing problem

Results 1 to 3 of 3

Thread: Javascript List box Option removing problem

  1. #1
    Antony Guest

    Default Javascript List box Option removing problem

    I am filling the list box (&#060;select&#062;) option values &#060;option&#062; from the server. After loading the page, i need to remove the values from the list box and i&#039ll be moving to another list box. i wrote a code using the remove method, it is working well in IE but not in Netscape.<BR>document.form1.select1.remove( document.form1.select1.options[i]);<BR>This code and similar codes works in IE but not in Netscape..<BR>Give me a solution

  2. #2
    Join Date
    Dec 1969

    Default RE: Javascript List box Option removing problem

    These functions are non-standard MS-only extensions to the DOM. This is how you do it on Netscape (according to Devedge):<BR><BR>"To delete an option from a Select object, you set the appropriate index of the options array to null. Removing an option compresses the options array. For example, assume that myList has 5 elements in it, the value of the fourth element is "foo", and you execute this statement:<BR><BR>myList.options[1] = null<BR>Now, myList has 4 elements in it and the value of the third element is "foo". <BR><BR>After you delete an option, you must refresh the document by using history.go(0). This statement must be last. When the document reloads, variables are lost if not saved in cookies or form element values."<BR><BR>Taken from:<BR><BR>Dunc

  3. #3
    Antony Guest

    Default RE: Thanx a lot Duncan King .. ur's is Ultimat

    Good solution..king

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts