Strange error

A

Aaron

I have 2 listbox server controls on my page that I've written a few js
functions to move the options between them. All works fine, except
when I call my function to re-sort the lists. After the items are
removed from one list and added to another, the following is called
passing the "list to be sorted" in as an object. If I put a simple
alert in after the sort method, it works fine. Once I remove the
alert, I get the "Unspecified error" blah blah blah.

Any thoughts?
Thanks
- Aaron

function sortList(l){
var holdValue = new Array()
for(j=0;j<l.length;j++){
holdValue[j] = l[j].value
}

holdValue.sort()
//UNREM THIS.. AND IT WORKS FINE
//alert("Looking OK")
l.length=0
for(j=0;j<holdValue.length;j++){
var o = new Option(holdValue[j],holdValue[j])
l.add(o)
}
}
 
T

Thomas 'PointedEars' Lahn

Aaron said:
I have 2 listbox server controls on my page

What server-side application are you using?
that I've written a few js functions to move the options between them.
All works fine, except when I call my function to re-sort the lists.

Where do you call the function(s)?
After the items are removed from one list and added to another, the
following is called passing the "list to be sorted" in as an object. If
I put a simple alert in after the sort method, it works fine. Once I
remove the alert, I get the "Unspecified error" blah blah blah.

"Does not work" is a useless error description. [psf 4.11]


PointedEars
 
S

Steven Daedelus

I have 2 listbox server controls on my page that I've written a few js
functions to move the options between them. All works fine, except
when I call my function to re-sort the lists. After the items are
removed from one list and added to another, the following is called
passing the "list to be sorted" in as an object. If I put a simple
alert in after the sort method, it works fine. Once I remove the
alert, I get the "Unspecified error" blah blah blah.

Any thoughts?
Thanks
- Aaron

function sortList(l){
var holdValue = new Array()
for(j=0;j<l.length;j++){
holdValue[j] = l[j].value
}

holdValue.sort()
//UNREM THIS.. AND IT WORKS FINE
//alert("Looking OK")
l.length=0
for(j=0;j<holdValue.length;j++){
var o = new Option(holdValue[j],holdValue[j])
l.add(o)
}
}

Don't know if this is the source of the error, but you really ought to
terminate your lines with semicolons.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,679
Members
48,796
Latest member
Greg L.

Latest Threads

Top