...

View Full Version : What if nothing is selected ?



registered_memb
06-03-2005, 04:33 AM
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

registered_memb
06-03-2005, 05:06 AM
Problem solved.

If no item is selected, selectedIndex returns -1.


Greeting



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum