凤凰求蛊
您可以将事件侦听器附加到jexcel表,这里有一个jsfiddle来演示如何监听单元格上的更改事件,这里也是代码作为片段(片段将不起作用,因为SO是沙箱,不允许某些代码运行,如果您进行测试,此片段将在您的本地计算机上工作):onchange<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script><html><script src="//bossanova.uk/jexcel/v4/jexcel.js"></script><script src="//bossanova.uk/jsuites/v2/jsuites.js"></script><link rel="stylesheet" href="//bossanova.uk/jexcel/v4/jexcel.css" type="text/css" /><link rel="stylesheet" href="//bossanova.uk/jsuites/v2/jsuites.css" type="text/css" /><div id="spreadsheet"></div><div> <button onclick="$('#log').html('')">Clear</button><br> <p>Log:</p> <div id="log" style="background-color:#c7eaff; border-radius:2px; color:#000; padding:20px"></div></div><script>var changed = function(instance, cell, x, y, value) { var cellName = jexcel.getColumnNameFromId([x,y]); $('#log').append('<p>New change on cell ' + cellName + ' to: ' + value + '</p>');}var data = [ ['Mazda', 2001, 2000, '2006-01-01'], ['Pegeout', 2010, 5000, '2005-01-01'], ['Honda Fit', 2009, 3000, '2004-01-01'], ['Honda CRV', 2010, 6000, '2003-01-01'],];jexcel(document.getElementById('spreadsheet'), { data:data, rowResize:true, columnDrag:true, columns: [ { type: 'text', width:'200' }, { type: 'text', width:'100' }, { type: 'text', width:'100' }, { type: 'calendar', width:'100' }, ], onchange: changed});</script></html>因此,您只需在事件侦听器中更改未保存的变量/标志即可,此示例也取自官方网站,其中有一个附加到jexcel表的事件侦听器列表onchange