<img id="img1" src="http://l.yimg.com/tw.yimg.com/a/tw/cathy/080620_09.jpg" hspace="20">
document.getElementById("img1").src="新的URL";

解决方案 »

  1.   


    <html>
    <head>
    <meta http-equiv="Content-Language" content="zh-tw">
    <meta http-equiv="Content-Type" content="text/html; charset=big5">
    <title>新增網頁2</title>
    </head>
    <body>
    <div align="center">
    <table border="1" width="100%" id="table3">
        <tr>
            <td>討論區</td>
        </tr>
    </table>
    <table border="1" width="100%" id="table1">
    <tr>
            <td width="195">日期:2008/06/20 19:13</td>
            <td> </td>
        </tr>
        <tr>
            <td width="195">名稱:</td>
            <td>xxxx</td>
        </tr>
        <tr><td width="195"><img src="http://l.yimg.com/tw.yimg.com/a/tw/cathy/080620_09.jpg" hspace="20"></td>
            <td> </td>
        </tr>
    </table>
    <SCRIPT LANGUAGE="JavaScript">
    alert(document.getElementById("table1").childNodes[0].childNodes[2].childNodes[0].childNodes[0].src)
    </SCRIPT>
    <table border="1" width="100%" id="table2">
        <tr>
            <td>修改</td>
        </tr>
    </table>
    </div>
    </body>
    </html>
      

  2.   


    <html>
    <head>
    <meta http-equiv="Content-Language" content="zh-tw">
    <meta http-equiv="Content-Type" content="text/html; charset=big5">
    <title>新增網頁2</title>
    </head>
    <body>
    <div align="center">
    <table border="1" width="100%" id="table3">
        <tr>
            <td>討論區</td>
        </tr>
    </table>
    <table border="1" width="100%" id="table1">
        <tr>
            <td width="195">日期:2008/06/20 19:13</td>
            <td> </td>
        </tr>
        <tr>
            <td width="195">名稱:</td>
            <td>xxxx</td>
        </tr>
        <tr>
            <td width="195"><img src="http://l.yimg.com/tw.yimg.com/a/tw/cathy/080620_09.jpg" hspace="20"></td>
            <td> </td>
        </tr>
    </table>
    <table border="1" width="100%" id="table2">
        <tr>
            <td>修改</td>
        </tr>
    </table>
    <SCRIPT LANGUAGE="JavaScript">
    alert(document.getElementById("table1").rows(2).childNodes[0].firstChild.src);
    </SCRIPT></div>
    </body>
    </html>
      

  3.   

    s_liangchao1s不好意思囉
    mingxuan3000比較早發兩位大大的方法都能抓到
    寫法有些微不同
    都很有學習價值
    在此多謝了