HTML DOM alt 屬性
定義和用法
alt 屬性可設(shè)置或返回在瀏覽器不支持單選按鈕時(shí)顯示的替代文本。
語(yǔ)法
radioObject.alt=alternate_text
實(shí)例
下面的例子可返回單選按鈕的 alt 文本:
<html> <body> <form> Male: <input id="male" alt="male" type="radio" name="Sex" value="Male" /> <br /> Female: <input id="female" alt="female" type="radio" name="Sex" value="Female" /> </form> <p>The alt text for the radio buttons are: <script type="text/javascript"> document.write(document.getElementById('male').alt
); document.write(" and "); document.write(document.getElementById('female').alt
); </script></p> </body> </html>