You are here: irt.org | FAQ | JavaScript | DHTML | Q1669 [ previous next ]
Try:
<script><!-- function changeIt(text) { if (document.layers) { document.layers['myILayer'].document.layers['myLayer'].document.open() document.layers['myILayer'].document.layers['myLayer'].document.write(text); document.layers['myILayer'].document.layers['myLayer'].document.close(); } else if (document.getElementById) document.getElementById('myCell').innerHTML = text; else if (document.all) document.all.myCell.innerHTML = text; } //--></script> <table> <tr> <td>This is the first sentence.</td> <td id="myCell"> <ilayer id="myILayer"> <layer id=myLayer style="position: relative;"> Black Text </layer> </ilayer> </td> <td>This is the second sentence.</td> </tr> </table> <form> <input value="Blue Text" type="button" onClick="changeIt('<font color=\'blue\'>Blue Text</font>')"> <input value="Red Text" type="button" onClick="changeIt('<font color=\'red\'>Red Text</font>')"> </form>