I have a set of span placeholders with id's ranging from 0 through n as:
<span id=msgR0></span>
<span id=msgR1><span>
..etc.
These are used to display a message using innerHTML. I clear the message
using: document.getElementById(msgR0).innerHTML = ' ', etc.
I built a simple loop to clear all fields:
for (var i=0; i<n+1; i++) {
value = 'msgR'+i;
//alert("i: "+i+" value: "+value);
document.getElementById(value).innerHTML = ' '
}
It fails and returns the error message: message:
Could not convert undefined or null to object" "
document.getElementById(value).innerHTML = " ";
If I insert the alert() statement before the innerHTML directive, the
function works. If I rem it out, the function fails.
Huh?
--
Ed Jay (remove 'M' to respond by email)