日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 前端技术 > HTML >内容正文

HTML

HTML DOM教程 19-HTML DOM Button 对象

發布時間:2025/3/15 HTML 26 豆豆
生活随笔 收集整理的這篇文章主要介紹了 HTML DOM教程 19-HTML DOM Button 对象 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

HTML DOM教程 19-HTML DOM Button 對象

?

  1:Button 對象

  Button 對象代表一個按鈕。

  在 HTML 文檔中 <button> 標簽每出現一次,Button 對象就會被創建。

  2:Button 對象的屬性

屬性描述IEFOW3C
accessKey設置或返回訪問某個按鈕的快捷鍵。619Yes
disabled設置或返回是否禁用按鈕。619Yes
form返回對包含按鈕的表單的引用。619Yes
id設置或返回按鈕的 id。619Yes
name設置或返回按鈕的名稱。619Yes
tabIndex設置或返回按鈕的 Tab 鍵控制次序。619Yes
type返回按鈕的表單類型。619Yes
value設置或返回顯示在按鈕上的文本。619Yes

  3:標準屬性

PropertyDescriptionIE?FOW3C
classNameSets or returns the class attribute of an element519Yes
dirSets or returns the direction of text519Yes
langSets or returns the language code for an element519Yes
titleSets or returns an element's advisory title519Yes

?  4:className 屬性  

  本例展示了兩種獲得 <body> 元素的 class 屬性的方法:

<html>
<body id="myid" class="mystyle">
<script type="text/javascript">
x=document.getElementsByTagName('body')[0];
document.write("Body CSS class: " + x.className);
document.write("<br />");
document.write("An alternate way: ");
document.write(document.getElementById('myid').className);
</script>
</body>
</html>

輸出:

Body CSS class: mystyle
An alternate way: mystyle

5:其他屬性演示

  <html>

<head>
<script type="text/javascript">
function alertId()
{
var txt="Id: " + document.getElementById("myButton").id

txt=txt + ", type: " + document.getElementById("myButton").type

txt=txt + ", type: " + document.getElementById("myButton").form
?

alert(txt)
document.getElementById("myButton").disabled=true
}
</script>
</head>

<body>
<form>
<button id="myButton" onClick="alertId()">請點擊我!</button>
</form>

</body>

??? </html>



總結

以上是生活随笔為你收集整理的HTML DOM教程 19-HTML DOM Button 对象的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。