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

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

DOM操作表格的各种属性[z]

發布時間:2025/6/15 编程问答 21 豆豆
生活随笔 收集整理的這篇文章主要介紹了 DOM操作表格的各种属性[z] 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

The TableData object represents an HTML table data element. For each instance of an HTML <td> tag in a document, a TableData object is created. TableDate對象代表了HTML表格的data元素。每當文檔中出現<yd>標簽,就有TableData對象被建立起來

IE:?Internet Explorer,?F:Firefox,N:Netscape,W3C:?World Wide Web Consortium (Internet Standard).

TableData 對象屬性

Property 屬性 Description 描述 IE? F N W3C
abbr Sets or returns an abbreviated text for the table cell (for non-visual media such as speech or Braille) 設置或返回表格單元格的縮寫文字(針對那些非視覺化的媒介) 6 ? ? Yes
accessKey Sets or returns the keyboard key to access the table cell 設置或返回表格單元的快速訪問鍵 4 ? ? No
align Sets or returns the horizontal alignment of data within the table cell 設置或返回在表格單元內數據的水平對齊方式 4 ? ? Yes
axis Sets or returns a comma-delimited list of related table cells (categories) 6 ? ? Yes
background Sets or returns the background image for the table cell 為表格單元設置或返回它的背景圖片 4 ? ? No
bgColor Sets or returns the background color for the table cell 為表格單元設置或返回它的背景顏色 4 ? ? Yes
borderColor Sets or returns the border color of the table cell 設置或返回表格單元的邊框顏色 4 ? ? No
cellIndex Returns the position of the cell in the cells collection of a row 返回在行中單元集合中單元的位置 4 ? ? Yes
ch Sets or returns the alignment character for the table cell 設置或返回表格單元的對齊特征 6 ? ? Yes
chOff Sets or returns the offset of alignment character for the table cell 設置或獲取可用于實現對象的你自己的 chOff 功能的字符串。 6 ? ? Yes
colSpan Sets or returns the number of columns the table cell should span 設置或獲取對象應該跨越的表格列數。 4 ? ? Yes
disabled Sets or returns whether or not the table cell should be disabled 設置或獲取控件的狀態。 5 ? ? No
headers Sets or returns a list of space-separated header cell ids 設置或獲取為對象提供信息的標題單元格。 6 ? ? Yes
height Sets or returns the height of the table cell 獲取或折紙表格單元的工作區域高度 4 ? ? No
id Sets or returns the id of the table cell (In IE 4 this property is read-only) 設置或返回表格單元的id 4 ? ? No
innerHTML Sets or returns the HTML between the start and end tags of the table cell 設置或返回在表格單元標簽之間的HTML內容 4 ? ? No
innerText Sets or returns the text between the start and end tags of the table cell 設置或返回在表格單元標簽之間的文字內容 4 ? ? No
noWrap Sets or returns a Boolean value indicating whether or not the browser automatically performs word wrap in the table cell 設置或獲取瀏覽器是否執行表格單元內的自動換行。[布爾值] 4 ? ? Yes
outerHTML Sets or returns the table data object and its content in HTML 設置或獲取表格單元對象及其內容的 HTML 形式。 4 ? ? No
outerText Sets or returns the text of the table data object 設置或獲取表格單元對象的文本。 4 ? ? No
rowSpan Sets or returns the number of rows the table cell should span 設置或獲取單元格要跨越表格的多少行。 4 ? ? Yes
scope ? 6 ? ? Yes
tabIndex Sets or returns the tab order for the table cell 設置或獲取定義對象的 Tab 順序的索引。 4 ? ? No
vAlign Sets or returns how cell content are vertically aligned 設置或獲取標題是表格的上面還是下面。 4 ? ? Yes
width Sets or returns the width of the table cell 設置或獲取表格單元的寬度 4 ? ? Yes

TableData 對象方法

Method 方法 Description 描述 IE F N W3C
blur() Removes focus from the table cell 取消表格單元的焦點 4 ? ? No
click() Simulates a mouse-click on the table cell 模仿鼠標對表格單元的點擊 4 ? ? No
focus() Sets focus on the table cell 為表格單元設置焦點 4 ? ? No

TableData 對象事件

Syntax: object.event_name="someJavaScriptCode" 語法:對象.事件名稱=“一些JS代碼”

Event 事件 Description 描述 IE F N W3C
onBlur Executes some code when the table cell loses focus 當表格單元失去焦點的時候執行一些代碼 4 ? ? ?
onClick Executes some code when the user clicks on the table cell 當用戶點擊表格單元的時候執行一些代碼 4 ? ? ?
onFocus Executes some code when the table cell gets focus 當表格單元得到檢點的時候執行一些代碼 4 ? ? ?
onSelectStart Executes some code when the table cell is selected 當表格單元被選中的時候執行一些代碼 4 ? ? ?

?

js 代碼
  • 下面看幾個例子吧: ??
  • 1,插入單元格 ??
  • ??
  • <html> ??
  • <head> ??
  • <script?type="text/javascript"> ??
  • function?addCell() ??
  • { ??
  • var?x=document.getElementById('myTable').rows[0] ??
  • var?y=x.insertCell(2) ??
  • y.innerHTML="新單元格"??
  • } ??
  • </script> ??
  • </head> ??
  • ??
  • <body> ??
  • <table?id="myTable"?border="1"> ??
  • <tr> ??
  • <td>行1?單元格1</td> ??
  • <td>行1?單元格2</td> ??
  • </tr> ??
  • <tr> ??
  • <td>行2?單元格1</td> ??
  • <td>行2?單元格2</td> ??
  • </tr> ??
  • <tr> ??
  • <td>行3?單元格1</td> ??
  • <td>行3?單元格2</td> ??
  • </tr> ??
  • </table> ??
  • <form> ??
  • <input?type="button"?οnclick="addCell()"?value="添加新的單元格"> ??
  • </form> ??
  • </body> ??
  • ??
  • </html> ??
  • ??
  • 2,對表格行里單元格的內容進行對齊 ??
  • ??
  • <html> ??
  • <head> ??
  • <script?type="text/javascript"> ??
  • function?alignRow() ??
  • { ??
  • var?x=document.getElementById('myTable').rows ??
  • x[0].align="right"??
  • x[0].valign="top"??
  • } ??
  • </script> ??
  • </head> ??
  • ??
  • <body> ??
  • <table?width="60%"?id="myTable"?border="1"> ??
  • <tr> ??
  • <td>行1?單元格1</td> ??
  • <td>行1?單元格2</td> ??
  • </tr> ??
  • <tr> ??
  • <td>行2?單元格1</td> ??
  • <td>行2?單元格2</td> ??
  • </tr> ??
  • <tr> ??
  • <td>行3?單元格1</td> ??
  • <td>行3?單元格2</td> ??
  • </tr> ??
  • </table> ??
  • <form> ??
  • <input?type="button"?οnclick="alignRow()"?value="右對齊第一行文字"> ??
  • </form> ??
  • </body> ??
  • ??
  • </html> ??
  • ??
  • 3,修改單元格的內容 ??
  • ??
  • <html> ??
  • <head> ??
  • <script?type="text/javascript"> ??
  • function?changeContent() ??
  • { ??
  • var?x=document.getElementById('myTable').rows[0].cells ??
  • x[0].innerHTML="POP"??
  • } ??
  • </script> ??
  • </head> ??
  • ??
  • <body> ??
  • <table?id="myTable"?border="1"> ??
  • <tr> ??
  • <td>行1?單元格1</td> ??
  • <td>行1?單元格2</td> ??
  • </tr> ??
  • <tr> ??
  • <td>行2?單元格1</td> ??
  • <td>行2?單元格2</td> ??
  • </tr> ??
  • <tr> ??
  • <td>行3?單元格1</td> ??
  • <td>行3?單元格2</td> ??
  • </tr> ??
  • </table> ??
  • <form> ??
  • <input?type="button"?οnclick="changeContent()"?value="改變第一個單元格文字"> ??
  • </form> ??
  • </body> ??
  • ??
  • </html> ??
  • ??
  • 4,改變表格行的colspan屬性值 ??
  • ??
  • <html> ??
  • <head> ??
  • <script?type="text/javascript"> ??
  • function?setColSpan() ??
  • { ??
  • var?x=document.getElementById('myTable').rows[0].cells ??
  • x[0].colSpan="2"??
  • x[1].colSpan="6"??
  • } ??
  • </script> ??
  • </head> ??
  • ??
  • <body> ??
  • <table?id="myTable"?border="1"> ??
  • <tr> ??
  • <td?colspan="4">單元格1</td> ??
  • <td?colspan="4">單元格2</td> ??
  • </tr> ??
  • <tr> ??
  • <td>單元格3</td> ??
  • <td>單元格4</td> ??
  • <td>單元格5</td> ??
  • <td>單元格6</td> ??
  • <td>單元格7</td> ??
  • <td>單元格8</td> ??
  • <td>單元格9</td> ??
  • <td>單元格10</td> ??
  • </tr> ??
  • </table> ??
  • <form> ??
  • <input?type="button"?οnclick="setColSpan()"?value="改變colspan值"> ??
  • </form> ??
  • </body> ??
  • ??
  • </html> ??
  • 總結

    以上是生活随笔為你收集整理的DOM操作表格的各种属性[z]的全部內容,希望文章能夠幫你解決所遇到的問題。

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

    主站蜘蛛池模板: 天天综合入口 | 亚洲一二三区在线 | 国产伊人一区 | 欧美精品在线观看一区二区 | 日批网址| 国产美女精品久久 | 裸体按摩www性xxxcom | xxxⅹ少妇少妇xxxx | 国产裸体美女永久免费无遮挡 | 久久午夜片 | 三级全黄视频 | 少妇一级淫片免费放播放 | 懂色tv | 欧美国产日韩一区 | 杨贵妃颤抖双乳呻吟求欢小说 | 玖操| 国产日韩欧美二区 | 91久久免费| 国产精品综合网 | 成年女人18级毛片毛片免费 | 在线免费观看污片 | 放荡的少妇2欧美版 | 日本打屁股网站 | a级在线看| 蜜臀av一区二区三区激情综合 | 国产乱子伦精品无码码专区 | 欧美精品久久久久久久久老牛影院 | 日本亲与子乱xxx | 久久入 | 久久色在线 | 精品97人妻无码中文永久在线 | 男人捅爽女人 | 亚洲不卡中文字幕 | 日韩大片免费观看视频播放 | 欧亚av在线| 欧美成人高清 | 亚洲黄视频 | 亚洲春色一区二区三区 | 免费毛片在线播放 | 99久久精品国产成人一区二区 | 婷婷操| 日韩激情视频网站 | 粉嫩av网站 | 天堂福利在线 | 爱如潮水3免费观看日本高清 | 在线免费观看一区 | 91国偷自产中文字幕久久 | 超碰超在线 | 天堂av成人 | 97香蕉久久超级碰碰高清版 | 天天操穴 | 国产一二三视频 | 四虎影院免费视频 | 欧美午夜精品理论片 | a级免费网站 | 精品在线视频播放 | av高清一区 | 国产一区二区精品丝袜 | 成年人看的羞羞网站 | 亚洲一区在线电影 | 欧美精品成人一区二区三区四区 | 中国三级视频 | 老熟女毛茸茸 | 蜜臀va| 婷婷丁香一区二区三区 | 在线视频中文字幕 | 在线观看视频一区二区三区 | 韩国三级与黑人 | 亚洲成人一级 | 理论片午夜| 亚洲视频一区在线 | 久久夜夜夜 | 狠狠干狠狠干 | 91黄色大片 | 欧美中文在线观看 | 69视频网址| 成人自拍偷拍 | 最新中文字幕在线观看视频 | 福利视频第一页 | 久热草 | 轮番上阵免费观看在线电影 | 台湾少妇xxxx做受 | 四虎影院一区二区 | 一级免费a | 久久精品a亚洲国产v高清不卡 | 各处沟厕大尺度偷拍女厕嘘嘘 | 肥婆大荫蒂欧美另类 | 日韩欧美国产高清 | 国产一区二区三区小说 | av在线影片 | 色就是色欧美色图 | 久久男人av | 亚洲av不卡一区二区 | 久草福利免费 | 狠狠做深爱婷婷久久综合一区 | 国产一区视频在线观看免费 | 奇米影视久久 | 福利片一区二区 | 妺妺窝人体色www在线小说 |