HTML DOM alt 属性
定义和用法
alt 属性设置或返回在浏览器不支持密码域时显示的替代文本。
语法
- 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>