<HTML>
<table width=100% height=200>
<tr>
<td id=mxh background=http://lucky.myrice.com/back.jpg>old text</td>
</tr>
</table>
<script>
function test(){
document.all.mxh.innerText="new text"
document.all.mxh.bgColor="#ff0000"
document.all.mxh.background="http://lucky.myrice.com/javabk1.jpg"
}
</script> 
<input type=button value=change onclick=test()>
</HTML>

解决方案 »

  1.   

    innerHTML
    例子:
    <HTML>
    <table width=100% height=200>
    <tr>
    <td id=mxh>old text</td>
    <td><img id=mxh2 src=http://lucky.myrice.com/back.jpg height=200 width=150></td>
    </tr>
    <tr>
    <td>old text</td>
    <td id=mxh3></td></tr>
    </table>
    <script>
    function test(){
    document.all.mxh.innerText="new text"
    document.all.mxh.bgColor="#ff0000"
    document.all.mxh2.src="http://lucky.myrice.com/javabk1.jpg"
    document.all.mxh3.innerHTML="<p>aaa<br><img src=http://lucky.myrice.com/javabk1.jpg>"
     }
    </script> 
    <input type=button value=change onclick=test()>
    </HTML>