HTML DOM alt 屬性
定義和用法
alt 屬性可設(shè)置或返回當(dāng)瀏覽器不支持按鈕時(shí)要顯示的替換文本。
語法
buttonObject.alt=alternate_text
實(shí)例
下面的例子可返回按鈕的 alt 文本:
<html>
<body>
<form>
<input type="button" alt="Button" id="button1"
value="Click me" />
</form>
<p>The alt text for the button is:
<script type="text/javascript">
x=document.getElementById('button1');
document.write(x.alt
);
</script></p>
</body>
</html>