当前位置: 首页 > 网络学院 > 客户端脚本教程 > HTML DOM > HTML DOM alt属性

HTML DOM
DOM TableRow 对象
DOM Textarea 对象
DOM Window 对象

HTML DOM alt属性


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-03-04   浏览: 393 ::
收藏到网摘: n/a

Definition and Usage
定义与用法

The alt property sets or returns an alternate text to display if a browser does not support checkboxes.
alt属性能够设置或返回对于那些无法支持checkbox浏览器的替换文字。

Syntax
语法

checkboxObject.alt=alternate_text


Example
举例

The following example returns the alt text for the checkboxes:
举例将返回checkbox的alt文字:

<html>

<body>
<form>
I have a bike: <input id="bike" alt="bike"
type="checkbox" name="Bike" />

<br />
I have a car: <input id="car" alt="car"
type="checkbox" name="Car" />

</form>
<p>The alt text for the checkboxes are:
<script type="text/javascript">
document.write(document.getElementById('bike').alt);
document.write(" and ");
document.write(document.getElementById('car').alt);
</script></p>
</body>

</html>


Try-It-Yourself Demos

Return the alt text for checkboxes
返回checkbox的alt文字

评论 (0) All

登陆 | 还没注册?