0

我按照用户建议的步骤: PostureOfLearning 并提出了一个测试代码,我将其粘贴在下面。它在 Chrome 中运行良好,但在 IE 中运行良好。如果我需要进行任何更改以使代码在 IE 中运行,请告诉我。提前致谢。

 <html>
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>  
 <script src="jquery.js" type="text/javascript"></script>  
 <script src="jquery.plugin.js" type="text/javascript"></script>  
 <script src="custom.js" type="text/javascript"></script> 
 <script src="C:\wamp\www\rrr\bin\jquery-handsontable-master\dist_wc\x-handsontable\jquery.handsontable.full.js"></script>
 <link rel="stylesheet" media="screen" href="C:\wamp\www\rrr\bin\jquery-handsontable-master\dist_wc\x-handsontable\jquery.handsontable.full.css">
 </head>
 <body>
 <div id="handsontableDivID">
 <script>
  var data = [
   ["", "Maserati", "Mazda", "Mercedes", "Mini", "Mitsubishi"],
   ["2009", 0, 2941, 4303, 354, 5814],
   ["2010", 5, 2905, 2867, 412, 5284],
   ["2011", 4, 2517, 4822, 552, 6127],
   ["2012", 2, 2422, 5399, 776, 4151]
             ];
  var config = {
    data: data,
    minRows: 5,
    minCols: 6,
    minSpareRows: 1,
    autoWrapRow: true,
    colHeaders: true,
    contextMenu: true
    };
    $("#handsontableDivID").handsontable(config);
   </script>
   </body>
   </html>

我得到的错误是 SCRIPT1014: Invalid character jquery.handsontable.full.js, line 1 character 1 SCRIPT438: Object doesn't support property or method 'handsontable' test1.html, line 32 character 1

4

1 回答 1

0

我假设您已将 zip 文件解压缩到您的网站解决方案中,并且您还安装了 jQuery。

在网页上,您需要确保添加指向您提取的 js 文件的脚本。就像是:

<script src="~/js/Handsontable/jquery.handsontable.js"></script>

并添加样式:

<link href="~/css/jquery.handsontable.css" rel="stylesheet" />

还有一些示例js:

var config = {} //Any config would be done here
$("#handsontableDivID").handsontable(config); //this initializes the table

从handsontable中取出数据并发送回服务器:

vara data = $("#handsontableDivID").handsontable('getInstance').getData();

查看示例以及操作方法:

http://handsontable.com/index.html

于 2013-09-26T12:51:39.823 回答