I´ve got a number of SPAN elements named "mySpan1", "mySpan2", "mySpan3"
etc, and want to set their "style.disp lay" to "inline".
This works (only needs to work on IE5.5+):
for (var x = 1; x < 20; x++) {
document.all('m ySpan'+x).style .display = "inline";
}
But I don´t know how many SPAN elements there are, so I need to set x to a
value big enough to change them all. This does, however, produce a error
when the function tries to set "style.disp lay" on a SPAN that doesn´t exist.
So I need to check if the SPAN element does exist before I try to set it´s
"style.display" .
for (var x = 1; x < 20; x++) {
If (document.all(' mySpan'+x)) <-- something like this (but that works ;)
document.all('m ySpan'+x).style .display = "inline";
}
But how do I do this? Help, anyone?
/Mike
etc, and want to set their "style.disp lay" to "inline".
This works (only needs to work on IE5.5+):
for (var x = 1; x < 20; x++) {
document.all('m ySpan'+x).style .display = "inline";
}
But I don´t know how many SPAN elements there are, so I need to set x to a
value big enough to change them all. This does, however, produce a error
when the function tries to set "style.disp lay" on a SPAN that doesn´t exist.
So I need to check if the SPAN element does exist before I try to set it´s
"style.display" .
for (var x = 1; x < 20; x++) {
If (document.all(' mySpan'+x)) <-- something like this (but that works ;)
document.all('m ySpan'+x).style .display = "inline";
}
But how do I do this? Help, anyone?
/Mike
Comment