源代碼
點擊運行
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>教程</title> </head> <body> <img id="image" src="/images/logo.png" width="160" height="120"> <script> document.getElementById("image").src="landscape.jpg"; </script> <p>原圖片為 /images/logo.png,腳本將圖片修改為 landscape.jpg</p> </body> </html>
運行結果