Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    May 2005
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    What if nothing is selected ?

    Hi,

    Can somebody help with this function:


    416 function deleteRow() {
    var sel= document.formList.iListBox.selectedIndex;
    if(sel!=null) {
    document.formList.iListBox.remove(sel);
    } else {
    alert("Please select an item");
    }
    }


    When I call this function (onClick), I get a Runtime Error:
    'Line 416
    Error: Invalid argument'



    Thanks in advance
    Last edited by registered_memb; 06-03-2005 at 05:51 AM.

  • #2
    New Coder
    Join Date
    May 2005
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Problem solved.

    If no item is selected, selectedIndex returns -1.


    Greeting


  •  

    Posting Permissions

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