It's getElementById(), not getElementByID(), so it would be:
document.getElementById("member_id").innerHTML
But:
document.getElementById("member_id").appendChild(d ocument.createTextNode("Member"));
is more standards compliant. Please note that the line above is
only required when initially appending text to the empty span.
Once the text node exists, you only need to change it's value. If
you're certain that the span will always only contain a text
node, you could use something like:
if (document.getElementById("member_id").firstChild == null) {
document.getElementById("member_id").appendChild(d ocument.createTextNode("Member"));
} else {
document.getElementById("member_id").firstChild.no deValue =
"Something Else";
}
Michael Hill wrote:
or it is:
document.getElementByID("member_id").innerHTML = "Member";
Michael Hill wrote:
I have this tag:
<span id="member_id"></span>
and I want to change the value to "Member"
why can't I do:
document.getElementByID("member_id").value = "Member";
Any help is appreciated.
Mike
--
| Grant Wagner <gw*****@agricoreunited.com>
* Client-side Javascript and Netscape 4 DOM Reference available
at:
*
http://devedge.netscape.com/library/...ce/frames.html
* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/a...ence_entry.asp
* Netscape 6/7 DOM Reference available at:
*
http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 7 / Mozilla
*
http://www.mozilla.org/docs/web-deve...upgrade_2.html