HTML DOM 표 규칙 특성
정의 및 사용
속성 집합 규칙 또는 가장자리 내부에 테이블을 리턴합니다.
문법
규칙 속성 설정 :
tableObject.rules="none|groups|rows|cols|all"
규칙 특성을 반환합니다 :
tableObject.rules
值 | 描述 |
---|---|
none | 没有内部边界 |
groups | 显示行组和列组之间的内部边界 |
rows | 显示内部行之间的边界 |
cols | 显示的列之间内部边界 |
all | 显示行和列之间的内边界 |
브라우저 지원
모든 주요 브라우저는 속성 규칙을 지원
참고 : IE9가 제대로이 속성을 표시 할 수 있습니다.사 내부 테두리에 추가 IE의 이전 버전, 우리는 또한 네 개의 외부 경계를 추가합니다.
참고 : 외부 경계에 영향을 미치는 외부 내부 경계에 추가 : 크롬과사파리가 제대로이 속성을 표시합니다.
예
예
다음의 예는 두 개의 서로 다른 내부 가장자리의 형태를 설정합니다 :
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>本教程(w3big.com)</title>
<script>
function rows(){
document.getElementById('myTable').rules="rows";
}
function cols(){
document.getElementById('myTable').rules="cols";
}
</script>
</head>
<body>
<table id="myTable">
<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="rows()">只显示行边界</button>
<button type="button" onclick="cols()">只显示列边界</button>
<p><b>注意:</b> rules属性在Internet Explorer 9之前版本不能正常显示。</p>
</body>
</html>
<html>
<head>
<meta charset="utf-8">
<title>本教程(w3big.com)</title>
<script>
function rows(){
document.getElementById('myTable').rules="rows";
}
function cols(){
document.getElementById('myTable').rules="cols";
}
</script>
</head>
<body>
<table id="myTable">
<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="rows()">只显示行边界</button>
<button type="button" onclick="cols()">只显示列边界</button>
<p><b>注意:</b> rules属性在Internet Explorer 9之前版本不能正常显示。</p>
</body>
</html>
»시도
표 개체