use*_*963 4 javascript css datatable
我有一个特殊的问题.我正在开发一个需要Datatables使用它的php站点.我注意到当我在localhost上运行它时,Datatables样式不起作用,无论是Firefox还是Chrome.我的代码如下:
<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
<head>
<meta charset="UTF-8">
<title></title>
<link rel="text/css" href="//cdn.datatables.net/1.10.12/css/jquery.dataTables.min.css"/>
<script src="//code.jquery.com/jquery-2.2.3.js" type="text/javascript"></script>
<script src="//cdn.datatables.net/1.10.12/js/jquery.dataTables.min.js" type="text/javascript"></script>
<script>
$(document).ready(function() {
$('#example').DataTable();
} );
</script>
</head>
<body>
<table id="example" class="display" cellspacing="0" width="100%">
<thead>
<tr>
<th>Name</th>
<th>Position</th>
<th>Office</th>
<th>Age</th>
<th>Start date</th>
<th>Salary</th>
</tr>
</thead>
<tfoot>
<tr>
<th>Name</th>
<th>Position</th>
<th>Office</th>
<th>Age</th>
<th>Start date</th>
<th>Salary</th>
</tr>
</tfoot>
<tbody>
<tr>
<td>Tiger Nixon</td>
<td>System Architect</td>
<td>Edinburgh</td>
<td>61</td>
<td>2011/04/25</td>
<td>$320,800</td>
</tr>
<tr>
<td>Garrett Winters</td>
<td>Accountant</td>
<td>Tokyo</td>
<td>63</td>
<td>2011/07/25</td>
<td>$170,750</td>
</tr>
<tr>
<td>Ashton Cox</td>
<td>Junior Technical Author</td>
<td>San Francisco</td>
<td>66</td>
<td>2009/01/12</td>
<td>$86,000</td>
</tr>
</tbody>
</table>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
这给了我一个相当难看的数据表版本.搜索功能和过滤工作,但缺少样式和列重新排序.
然而奇怪的是,我绘制的jsfiddle包含相同的数据呈现预期,所有样式等...小提琴链接如下:https://jsfiddle.net/gkyya29h/
我正在使用带有firefox的XAMPP服务器作为我的默认浏览器.有人可以帮我解决这个问题吗?我可能会做一些非常明显的错误,但我没有看到它.谢谢.
Eis*_*dil 11
<link rel="stylesheet" type="text/css" href="//cdn.datatables.net/1.10.12/css/jquery.dataTables.min.css">
Run Code Online (Sandbox Code Playgroud)
你的CSS链接标签是错误的.也许某些浏览器无法正确处理它.