3

我有一些代码,它在堆栈片段上运行良好。

但是当我将它插入到我的服务器上或只是在 .html 文件中时,刷新按钮会变小!

在此处输入图像描述

<link href="http://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.2/css/bootstrap.css" rel="stylesheet"/>
<link href="http://cdnjs.cloudflare.com/ajax/libs/jquery-bootgrid/1.1.4/jquery.bootgrid.css" rel="stylesheet"/>

<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.2/js/bootstrap.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery-bootgrid/1.1.4/jquery.bootgrid.js"></script>


<script>
 $(function () {
      var testGrid = $("#testGrid").bootgrid({
        navigation: 3,
        ajax: true,
        url: "controllers/getListFiles",
        post: function () {
          return {
            type: 'req',
            expanded: $('#exp').text()
          };
        },
        responseHandler: function (response)
        {
          return response.data;
        }
      });
    });
</script>



    <div id="autoOut" class="tab-pane fade in active">
      <span id="exp" style="display: none;"></span>
      <h3>Auto OUT</h3>
      <table id="testGrid" class="table table-condensed table-hover table-striped">
        <thead>
          <tr>
            <th data-column-id="date" class="col-md-3">Дата/Время</th>
            <th data-column-id="expander" data-formatter="expander" class="col-md-1">Список</th>
            <th data-column-id="file" class="col-md-4">Имя файла</th>
            <th data-column-id="uid" class="col-md-4">UID</th>
            <th data-column-id="accReqId" class="col-md-2">AccountsRequestId</th>
          </tr>
        </thead>
      </table>
    </div>
有代码的复制和粘贴,没有什么不同!是否有一些代码片段让它工作,我怎样才能让它在我的服务器上工作?有关我以前的问题的更多信息。

4

1 回答 1

2

确保在将代码移动到自己的 html 文件时指定 doctype。Stack Snippets 和 JS Fiddle 会自动将 HTML5 文档类型添加<!DOCTYPE html>到它们的输出中(尽管在 JS Fiddle 的情况下这是可配置的)。不提供 doctype 会导致奇怪的结果,因为浏览器不知道要使用哪种渲染模式。

取自http://www.w3.org/QA/Tips/Doctype

但最重要的是,对于大多数浏览器家族来说,一个 doctype 声明将使很多猜测变得不必要,从而触发“标准”渲染模式。

于 2015-05-08T15:21:26.707 回答