Tuesday, February 26, 2013

Changing Text with innerHTML

 <script type="text/javascript">
function changeText(){
 document.getElementById('boldStuff').innerHTML = 'Fred Flinstone';
}
</script>
<p>Welcome to the site <b id='boldStuff'>dude</b> </p> 
<input type='button' onclick='changeText()' value='Change Text'/>

EXAMPLE:

Welcome to the site dude