HTML DOM value 属性
定义和用法
value 属性设置或返回显示在按钮上的文本。
语法
- buttonObject.value=value
实例
下面的例子可返回显示在按钮上的文本:
- <html>
- <body>
- <input type="button" id="button1" name="button1" value="Click Me!" />
- <p>The text on the button is:
- <script type="text/javascript">
- x=document.getElementById('button1');
- document.write(
x.value
);- </script></p>
- </body>
- </html>