Table deleteTHead() 方法
 Table 对象
 Table 对象
定义和用法
deleteTHead() 方法用于从表格删除 <thead> 元素。提示: 在表格中创建 thead 元素请使用 createTHead() 方法。
语法
tableObject.deleteTHead()
浏览器支持





所有主要浏览器都支持 deleteTHead() 方法
实例
实例
创建和删除 thead 元素:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>代码学院(codexy.cn)</title>
<script>
function createTHead(){
var x=document.getElementById("myTable");
if (!x.tHead){
var header=x.createTHead();
var row=header.insertRow(0);
var cell=row.insertCell(0);
cell.innerHTML="<b>这是个表头</b>";
}
}
function deleteTHead(){
document.getElementById("myTable").deleteTHead();
}
</script>
</head>
<body>
<table id="myTable" border="1">
<tr>
<td>cell 1</td>
<td>cell 2</td>
</tr>
<tr>
<td>cell 3</td>
<td>cell 4</td>
</tr>
</table>
<br>
<button type="button" onclick="createTHead()">创建表头</button>
<button type="button" onclick="deleteTHead()">删除表头</button>
</body>
</html>
<html>
<head>
<meta charset="utf-8">
<title>代码学院(codexy.cn)</title>
<script>
function createTHead(){
var x=document.getElementById("myTable");
if (!x.tHead){
var header=x.createTHead();
var row=header.insertRow(0);
var cell=row.insertCell(0);
cell.innerHTML="<b>这是个表头</b>";
}
}
function deleteTHead(){
document.getElementById("myTable").deleteTHead();
}
</script>
</head>
<body>
<table id="myTable" border="1">
<tr>
<td>cell 1</td>
<td>cell 2</td>
</tr>
<tr>
<td>cell 3</td>
<td>cell 4</td>
</tr>
</table>
<br>
<button type="button" onclick="createTHead()">创建表头</button>
<button type="button" onclick="deleteTHead()">删除表头</button>
</body>
</html>
尝试一下 »
 Table 对象
 Table 对象			
						
			
 JavaScript 教程
JavaScript 教程 JavaScript 对象
JavaScript 对象 jQuery 教程
jQuery 教程 JSON 教程
JSON 教程 AngularJS 教程
AngularJS 教程 Angular 2 教程
Angular 2 教程 Vue.js 教程
Vue.js 教程 React 教程
React 教程 jQuery UI 教程
jQuery UI 教程 jQuery EasyUI 教程
jQuery EasyUI 教程 AJAX 教程
AJAX 教程 Highcharts 教程
Highcharts 教程 Google Maps API 教程
Google Maps API 教程 ES6 教程
ES6 教程 TypeScript教程
TypeScript教程 ES6 标准入门
ES6 标准入门