HTML
# 页面获取getElementsByClassName()并对其操作
报错<Uncaught TypeError: document.getElementsByClassName(...).方法名is not a function
// 解决方法: // 这是因为选择器没有正确选择元素对象 document.getElementsByClassName(...)捕捉到的是该类名元素的数组 // 正确的访问方式应该是: document.getElementsByClassName(...)[0].方法名... // ------Example------ document .getElementsByClassName(index)[0] .scrollIntoView({ behavior: 'smooth', inline: 'nearest' });
1
2
3
4
5
6
7
8
9
10
# 表格
<table border="1px">
<caption>标题信息</caption>
<tr>
<th>表头1</th>
<th>表头2</th>
</tr>
<tr>
<td>单元格1</td>
<td>单元格2</td>
</tr>
</table>
1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
th 表头 th内部的文字样式为
居中
+粗体
tr 行
td 单元格
[th]、[td] 都可以跨列[左右属于列]操作(colspan)、跨行[上下属于行]操作(rowspan)
# 特殊符号
- 小于
<
- 大于
>
编辑 (opens new window)
上次更新: 2024-07-15 23:22:40