【发布时间】:2017-08-18 20:04:20
【问题描述】:
我只是在做一个简单的 DataTable 显示,但我注意到当页面加载时,无样式的 HTML 数据表出现在样式化的 DataTable 出现之前。有人可以指出为什么会发生这种情况吗?脚本和链接声明的顺序有区别吗?
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Demo DataTable Display</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<link rel="stylesheet" href="http://cdn.datatables.net/1.10.15/css/jquery.dataTables.min.css">
<script src="https://cdn.datatables.net/1.10.15/js/jquery.dataTables.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.15/css/dataTables.bootstrap.min.css">
<script src="https://cdn.datatables.net/1.10.15/js/dataTables.bootstrap.min.js"></script>
<script>
$(document).ready(function(){
$('#example').DataTable();
});
</script>
</head>
<body>
<table id="example" class="display">
<thead>
<tr>
<th>Column 1</th>
<th>Column 2</th>
</tr>
</thead>
<tbody>
<tr>
<td>Row 1 Data 1</td>
<td>Row 1 Data 2</td>
</tr>
<tr>
<td>Row 2 Data 1</td>
<td>Row 2 Data 2</td>
</tr>
</tbody>
</table>
</body>
</html>
【问题讨论】:
-
尝试在页面底部添加脚本
-
我尝试将脚本移到