alt 屬性可設置或返回圖像無法顯示時的替代文本。
imageObject.alt=alternate_text
下面的例子將更改圖像的替代文本:
<html> <head> <script type="text/javascript"> function changeAlt() {document.getElementById("compman").alt="Man using computer"
} function alertAlt() { alert(document.getElementById("compman").alt
) } </script> </head> <body> <img id="compman" src="compman.gif" alt="Computerman" /> <br /> <input type="button" onclick="changeAlt()" value="Change alt text"> <br /><br /> <input type="button" onclick="alertAlt()" value="Alert alt text"> </body> </html>
如對本文有疑問,請?zhí)峤坏浇涣髡搲?,廣大熱心網(wǎng)友會為你解答?。?點擊進入論壇
Powered by 365建站網(wǎng) RSS地圖 HTML地圖
copyright © 2013-2024 版權(quán)所有 鄂ICP備17013400號