I
Iver Erling Årva
I have the following function which I call from a <input type="button">'s onclick event:
function showHideSub(cntrl,varclass){
var myclass = varclass;
DIVColl=document.all.tags("tr");
if (cntrl.value == "+"){
cntrl.value = "-";
for (i=0; DIVColl.length; i++){
if ((DIVColl(i).className) == myclass){
DIVColl(i).style.display="";
}
}
}
else {
cntrl.value = "+";
for (i=0; DIVColl.length; i++){
if (DIVColl(i).className == myclass){
DIVColl(i).style.display="none";
}
}
}
}
I use this function to show/hide an extra line of details under some invoice charge items, so by hitting the + button, the details are displayed and + is changed to -. By hitting it again the extra line is hidden and the - is changed back to + and so on.
Now, this seem to work, but every time I hit the button and the function has done it's job, I get an error message saying: Requires Object. The line it crashes on is if ((DIVColl(i).className) == myclass){
I cannot understand why it does this? In this case i is 19 and DIVColl.length is 19 too, but if I change it to for (i=0; DIVColl.length-1; i++){ I get the same error although i then is 18.
Any help would be most appreciated!
Brgds
(e-mail address removed)
function showHideSub(cntrl,varclass){
var myclass = varclass;
DIVColl=document.all.tags("tr");
if (cntrl.value == "+"){
cntrl.value = "-";
for (i=0; DIVColl.length; i++){
if ((DIVColl(i).className) == myclass){
DIVColl(i).style.display="";
}
}
}
else {
cntrl.value = "+";
for (i=0; DIVColl.length; i++){
if (DIVColl(i).className == myclass){
DIVColl(i).style.display="none";
}
}
}
}
I use this function to show/hide an extra line of details under some invoice charge items, so by hitting the + button, the details are displayed and + is changed to -. By hitting it again the extra line is hidden and the - is changed back to + and so on.
Now, this seem to work, but every time I hit the button and the function has done it's job, I get an error message saying: Requires Object. The line it crashes on is if ((DIVColl(i).className) == myclass){
I cannot understand why it does this? In this case i is 19 and DIVColl.length is 19 too, but if I change it to for (i=0; DIVColl.length-1; i++){ I get the same error although i then is 18.
Any help would be most appreciated!
Brgds
(e-mail address removed)