<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<style>
</style>
<body>
<table class="dataintable">
<thead>
<tr>
<th>类型</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td>text</td>
<td>定义常规文本输入。</td>
</tr>
<tr>
<td>radio</td>
<td>定义单选按钮输入(选择多个选择之一)</td>
</tr>
<tr>
<td>submit</td>
<td>定义提交按钮(提交表单)</td>
</tr>
</tbody>
</table>
</body>
</html>
<script>
let tr=document.querySelector('tbody').querySelectorAll('tr');
for (let i = 0; i < tr.length; i++) {
//鼠标经过变粉色
tr[i].onmouseover=function()
{
this.style.backgroundColor='pink';
}
//鼠标离开变空
tr[i].onmouseout=function()
{
this.style.backgroundColor='';
}
}
</script>