HTML DOM alt 屬性
定義和用法
alt 屬性設(shè)置或返回在瀏覽器不支持密碼域時顯示的替代文本。
語法
passwordObject.alt=alternate_text
實例
下面的例子可返回密碼域的替代文本:
<html>
<body>
<form>
<input type="password" alt="Password field" id="pwd1" />
</form>
<p>The alt text for the password field is:
<script type="text/javascript">
x=document.getElementById('pwd1');
document.write(x.alt
);
</script></p>
</body>
</html>