GetElementById

[Total: 0    Average: 0/5]

This shows how to alter text by use of the getElementById.

Body Code:

<style>
.one {color: red;}
.changed {color: green;}
</style>
<table border=1>
<tr>
<td><span id=one class=one>one</span></td><td><span id=two>two</span></td>
</tr>
</table>
<HR>
<script>
function change()
{
  if(document.getElementById)
  {
    document.getElementById("one").innerHTML="changed";
    document.getElementById("one").className="changed";
  }
}
</script>
<a href="javascript:change()">Change</a>

Times Viewed: 0

Leave a Reply

Your email address will not be published. Required fields are marked *