DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Change Text

09.16.2006
| 17888 views |
  • submit to reddit
        // javascript to change text

<script type="text/javascript">
function changeText(txt){
	document.getElementById('the_text').innerHTML = txt;
}
</script>
<p>Hello <b id='name'>World</b>. </p>
<input type='button' onclick='changeText("Oliver")' value='Change Text'/>