HTML DOM alt 屬性
定義和用法
alt 屬性可設(shè)置或返回瀏覽器不支持隱藏域時(shí)顯示的文本。
語法
hiddenObject.alt=alternate_text
實(shí)例
下面的例子返回了隱藏輸入域的 alt 文本:
<html>
<body>
<form>
<input type="hidden" alt="Hidden field" id="hidden1" />
</form>
<p>The alt text for the hidden field is:
<script type="text/javascript">
x=document.getElementById('hidden1');
document.write(x.alt
);
</script></p>
</body>
</html>