Baseline Widely available
HTMLTableCellElement
æ¥å£ç rowSpan
åªè¯»å±æ§è¡¨ç¤ºæ¤åå
æ ¼å¿
须跨è¶çè¡æ°ï¼è¿å
许åå
æ ¼å¨è¡¨æ ¼çå¤è¡ä¹é´å æ®ç©ºé´ãå®åæ rowSpan
屿§ã
ä¸ä¸ªè¡¨ç¤ºè¡æ°çæ£æ°ãå¦ææ¯ 0
ï¼å表示该å䏿æå©ä½è¡ã
夿³¨ï¼ å½è®¾ç½®æ°å¼æ¶ï¼ä»»ä½ä¸æ¯ 0 çå¼ä¼è¢«é³å¶å°ææ¥è¿çä¸¥æ ¼æ£æ°ã
示ä¾ç¤ºä¾æä¾äºä¸¤ä¸ªæé®æ¥ä¿®æ¹ä¸»ä½ç¬¬ä¸ä¸ªåå æ ¼çè¡è·¨åº¦ã
HTML<table>
<thead>
<tr>
<th>å 1</th>
<th>å 2</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>1</td>
</tr>
<tr>
<td rowspan="2">2</td>
<td>2</td>
</tr>
<tr>
<td>3</td>
<td>3</td>
</tr>
<tr>
<td>4</td>
<td>4</td>
</tr>
</tbody>
</table>
<button id="increase">å¢å å跨度</button>
<button id="decrease">åå°å跨度</button>
<div>第ä¸ä¸ªåç第äºä¸ªåå
æ ¼è·¨è¶<output> 2 </output>è¡ã</div>
table {
border-collapse: collapse;
}
th,
td,
table {
border: 1px solid black;
}
button {
margin: 1em 1em 1em 0;
}
JavaScript
// è·åç¸å
³æ¥å£å
ç´
const row = document.querySelectorAll("tbody tr")[1];
const cell = row.cells[0];
const output = document.querySelectorAll("output")[0];
const increaseButton = document.getElementById("increase");
const decreaseButton = document.getElementById("decrease");
increaseButton.addEventListener("click", () => {
cell.rowSpan = cell.rowSpan + 1;
// æ´æ°æ¾ç¤º
output.textContent = ` ${cell.rowSpan} `;
});
decreaseButton.addEventListener("click", () => {
cell.rowSpan = cell.rowSpan - 1;
// æ´æ°æ¾ç¤º
output.textContent = `${cell.rowSpan == 0 ? "ææå©ä½ç" : " " + cell.rowSpan + " "}`;
});
ç»æ è§è æµè§å¨å
¼å®¹æ§ åè§
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4