HTML DOM name 屬性
定義和用法
name 屬性可設(shè)置或返回按鈕的名稱。
語法
buttonObject.name=name
實例
下面的例子可返回按鈕的名稱:
<html>
<body>
<button id="button1" name="button1">
Click Me!</button>
<p>The name of the button is:
<script type="text/javascript">
x=document.getElementById('button1');
document.write(x.name
);
</script></p>
</body>
</html>