| Refresh | Home EGTry.com

update text dynamically without refreshing the page


CommentsHTML sourcedisplay in your current browser
<script type="text/javascript">
function goupdate() {
	var obj=document.getElementById("name1");
	var nodes=obj.childNodes; //NodeList
	var textNode=nodes.item(0); //TextNode
	textNode.nodeValue="Name changed";
	return false;
}
</script>
<a href="#" onclick="javascript:goupdate();return false;">Click to change the text below</a>
<p/>

<fond id="name1">John</font>

Click to change the text below

John