当前位置:   article > 正文

jQuery实现表格冻结行和列

jq固定表格前面几列

  前几天,遇到一个需求是要将表格的前几行和前几列冻结即固定,就是在有滚动条的情况下,保持那几行和那几列固定,这个需求其实是一个非常常见的需求,因为在涉及好多行和列时,在拖动滚动条时,我们需要知道每行每列表示的是什么意思,当被遮挡后,就很难记住是表示的什么内容了,如下图所示:我想要保持学生姓名和在线状态保持不动,以及前三行表示章节以及微课习题的内容保持不变,当然在easyui或者其他的一些插件里这种特性早已经有了,例如在easyui中有frozen属性,可以设定哪一行哪一列进行冻结,具体可以看官方的列子EasyUI在数据表格中冻结的行和列, 当然这些在特定的行和列中使用是很方便的,但是针对我的需求确实相当的麻烦,因为在之前所有的数据以及表格的生成都已经完成了,再进行改写会很费时费力,而且在我的需求中行和列都是动态的,所有的内容都是动态的,

于是翻遍了整个园子,终于找到了一个合适的解决办法,有人写了这样一个插件,TableFreeze.js,它的实现原理其实跟easyui的原理是一样的,实际上是创建了多个Table,将所有的固定的行和列都Clone了一个table,进行重叠放置,进行绝对定位,这样不管是横向还是竖向,都会有重复的表格保持不动,在视觉上就形成了冻结,实际上拖动时原来的表格还是在动的,下面附上所有的引用的插件,注意在TableFreeze.js中有一个地方是判断是否是IE浏览器的,语法是这样的if($.browser.msie){} 这一句应该是在jQuery1.9以后就去掉了,不再支持了,需要引入另一个插件jquery-migrate-1.2.1.js 这个jQuery插件会把jQuery高版本中去掉的语法或特性都给补充完整,保证以前的写法可以继续使用,所以在引入冻结行和列的js前要先引入这个插件,下面引入我的代码块(后台找不到原来文章的出处了,我将所有的代码都放入到了我的博客中,如有见过,请帮忙标注文章出处,本文也只是站在前人的肩膀上改造):

  1. /*********************************
  2. ** 名称:JQeury实现表格行列冻结
  3. **
  4. ** 作者:YJJ
  5. **
  6. ** 时间:2014年4月16日
  7. **
  8. ** 修改人:Allen
  9. **
  10. ** 修改时间:2017-06-10
  11. **
  12. ** 修改记录:兼容
  13. **
  14. ** 描述:类似Excel中的冻结窗格功能.建议给出表头固定宽度,所有单元格的高度,指定表格宽度;
  15. **********************************/
  16. $.fn.mergeAttributes = function(src){
  17. if($.browser.msie) {
  18. $(this).get(0).mergeAttributes(src.get(0));
  19. }else{
  20. attrs = src.get(0).attributes;
  21. i = attrs.length - 1;
  22. for(;i>=0;i--){
  23. var name = attrs[i].name;
  24. if(name.toLowerCase() === 'id' || attrs[i].value=="" || attrs[i].value==null ||attrs[i].value=="null"){
  25. continue;
  26. }
  27. try{
  28. $(this).attr(name,attrs[i].value);
  29. }catch(e){
  30. }
  31. }
  32. }
  33. }
  34. $.fn.FrozenTable = function(iRowHead,iRowFoot,iColLeft){//3,0,1
  35. var oTable = $(this);
  36. var oTableId = oTable.attr("id");
  37. var oDiv = $(this).parent();
  38. if(oDiv.get(0).tagName != "DIV") return;
  39. oTable.find("td").attr("noWrap","nowrap");
  40. //oTable.css("table-layout","fixed");
  41. if (oTable.width() > oDiv.width() && oTable.height() > oDiv.height()) {
  42. if(iRowHead>0 && iColLeft>0){
  43. var oCloneTable = $("<table id='oTableLH_"+oTableId+"'></table>");//创建的是左侧列和行交集的表头
  44. oDiv.parent().append(oCloneTable);
  45. oCloneTable.CloneTable(oTable,0,iRowHead,iColLeft);
  46. oCloneTable.css("position","absolute");
  47. oCloneTable.css("z-index","1004");
  48. oCloneTable.css("left",oDiv.offset().left);
  49. oCloneTable.css("border-bottom-style",'none');
  50. oCloneTable.css("border-top-style", 'none');
  51. oCloneTable.css("top",oDiv.offset().top);
  52. }
  53. if(iRowFoot>0 && iColLeft>0){
  54. var oCloneTable = $("<table id='oTableLF_"+oTableId+"'></table>");
  55. oDiv.parent().append(oCloneTable);
  56. oCloneTable.CloneTable(oTable,oTable.find("tr").length-iRowFoot,oTable.find("tr").length,iColLeft);
  57. oCloneTable.css("position","absolute");
  58. oCloneTable.css("z-index","1003");
  59. oCloneTable.css("left",oDiv.offset().left);
  60. oCloneTable.css("top",(oDiv.offset().top+oDiv.outerHeight(true)-oCloneTable.outerHeight(true)-17));
  61. }
  62. }
  63. if (iRowHead > 0 && oTable.height() > oDiv.height()) {
  64. var oCloneDiv = $("<div id='oDivH_"+oTableId+"'><table></table></div>");
  65. oDiv.parent().append(oCloneDiv);
  66. oCloneDiv.find("table").CloneTable(oTable,0,iRowHead,-1);
  67. oCloneDiv.css("overflow","hidden");
  68. oCloneDiv.css("width",oDiv.outerWidth(true)-17);
  69. oCloneDiv.css("position","absolute");
  70. oCloneDiv.css("z-index","1002");
  71. oCloneDiv.css("left",oDiv.offset().left);
  72. oCloneDiv.css("top",oDiv.offset().top);
  73. }
  74. if (iRowFoot > 0 && oTable.height() > oDiv.height()) {
  75. var oCloneDiv = $("<div id='oDivF_"+oTableId+"'><table></table></div>");
  76. oDiv.parent().append(oCloneDiv);
  77. oCloneDiv.find("table").CloneTable(oTable,oTable.find("tr").length-iRowFoot,oTable.find("tr").length,-1);
  78. oCloneDiv.css("overflow","hidden");
  79. oCloneDiv.css("width",oDiv.outerWidth(true)-17);
  80. oCloneDiv.css("position","absolute");
  81. oCloneDiv.css("z-index","1001");
  82. oCloneDiv.css("left",oDiv.offset().left);
  83. oCloneDiv.css("top",oDiv.offset().top+oDiv.outerHeight(true)-oCloneTable.outerHeight(true)-17);
  84. }
  85. if (iColLeft > 0 && oTable.width() > oDiv.width()) {
  86. var oCloneDiv = $("<div id='oDivL_"+oTableId+"'><table></table></div>");
  87. oDiv.parent().append(oCloneDiv);
  88. oCloneDiv.find("table").CloneTable(oTable,0,oTable.find("tr").length,iColLeft);
  89. oCloneDiv.css("overflow","hidden");
  90. oCloneDiv.css("height",oDiv.outerHeight(true)-17);
  91. oCloneDiv.css("position","absolute");
  92. oCloneDiv.css("z-index","1000");
  93. //oCloneDiv.css("left", oDiv.offset().left);//注释掉可解决错乱问题
  94. oCloneDiv.css("top",oDiv.offset().top);
  95. }
  96. oDiv.scroll(function(){
  97. if(typeof($("#oDivH_"+oTableId).get(0))!='undefined'){
  98. $("#oDivH_"+oTableId).scrollLeft($(this).scrollLeft());
  99. }
  100. if(typeof($("#oDivF_"+oTableId).get(0))!='undefined'){
  101. $("#oDivF_"+oTableId).scrollLeft($(this).scrollLeft());
  102. }
  103. if(typeof($("#oDivL_"+oTableId).get(0))!='undefined'){
  104. $("#oDivL_"+oTableId).scrollTop($(this).scrollTop());
  105. }
  106. });
  107. };
  108. $.fn.CloneTable = function(oSrcTable,iRowStart,iRowEnd,iColumnEnd){
  109. var iWidth = 0,iHeight = 0;
  110. $(this).mergeAttributes(oSrcTable);
  111. var Log="";
  112. var rowspanValue = 0;
  113. var rowNumber = 0;
  114. var rowIndex;
  115. for(var i=iRowStart;i<iRowEnd;i++){
  116. var oldTr = oSrcTable.find("tr").eq(i);
  117. var isSingleRowspan = false;
  118. var rowspanCount = 0;
  119. var colCount = 0;
  120. var colNumber = 0;
  121. for(var j=0; j<(iColumnEnd==-1?oldTr.find("td").length:iColumnEnd); j++){
  122. var oidTd = oldTr.find("td").eq(j);
  123. colNumber++;
  124. var colspan = oidTd.attr("colspan");
  125. if (typeof(colspan)=="undefined" || colspan==1) {
  126. colCount += 1;
  127. }else{
  128. colCount += colspan;
  129. }
  130. var rowspan = oidTd.attr("rowspan");
  131. if(typeof(rowspan)!="undefined" && rowspan!=1){
  132. rowspanCount++;
  133. rowIndex = i;
  134. rowspanValue = rowspan;
  135. rowNumber = rowspanCount;
  136. }
  137. if(colCount>=iColumnEnd && iColumnEnd!=-1){
  138. break;
  139. }
  140. }
  141. Log +=i+"=="+rowIndex+"="+rowspanCount+"="+rowNumber+"="+rowspanValue+"<br>";
  142. if(i>rowIndex && i<=(rowIndex+rowspanValue-1) && iColumnEnd!=-1){
  143. if(rowNumber!=0 && iColumnEnd==rowNumber){
  144. isSingleRowspan = true;
  145. }else{
  146. colNumber -= 1;
  147. if(rowspanCount==0){
  148. colNumber -= (rowNumber-1);
  149. }
  150. }
  151. }
  152. if(colNumber!=0){
  153. var newTr = $("<tr></tr>");
  154. newTr.mergeAttributes(oldTr);
  155. var jWidth = 0;
  156. iHeight += oldTr.outerHeight(true);
  157. for(var j=0; j<colNumber;j++){
  158. if(isSingleRowspan){
  159. continue;
  160. }
  161. var oidTd = oldTr.find("td").eq(j);
  162. var newTd = oidTd.clone();
  163. /*IE 一行多列合并时
  164. if(iColumnEnd==-1 && iRowStart!=0 && $.browser.msie){
  165. if (typeof(newTd.attr("colspan"))!="undefined" && newTd.attr("colspan")!=1) {
  166. alert(newTd.text()+"==2=="+newTd.attr("colspan")+"---"+colCount);
  167. }
  168. }
  169. if(iColumnEnd==-1 && iRowStart!=0 && j==1){
  170. newTd.width(oidTd.outerWidth(true)-1);
  171. jWidth += (oidTd.outerWidth(true)-1);
  172. }else{
  173. newTd.width(oidTd.outerWidth(true));
  174. jWidth += oidTd.outerWidth(true);
  175. }*/
  176. newTd.height(oidTd.outerHeight(true)-1);
  177. newTd.width(oidTd.outerWidth(true));
  178. jWidth += oidTd.outerWidth(true);
  179. iWidth = Math.max(iWidth,jWidth);
  180. newTr.append(newTd);
  181. }
  182. $(this).append(newTr);
  183. }
  184. }
  185. $(this).width(iWidth);
  186. $(this).height(iHeight);
  187. }

jquery-migrate-1.2.1.js

  1. /*!
  2. * jQuery Migrate - v1.2.1 - 2013-05-08
  3. * https://github.com/jquery/jquery-migrate
  4. * Copyright 2005, 2013 jQuery Foundation, Inc. and other contributors; Licensed MIT
  5. */
  6. (function( jQuery, window, undefined ) {
  7. // See http://bugs.jquery.com/ticket/13335
  8. // "use strict";
  9. var warnedAbout = {};
  10. // List of warnings already given; public read only
  11. jQuery.migrateWarnings = [];
  12. // Set to true to prevent console output; migrateWarnings still maintained
  13. // jQuery.migrateMute = false;
  14. // Show a message on the console so devs know we're active
  15. if ( !jQuery.migrateMute && window.console && window.console.log ) {
  16. window.console.log("JQMIGRATE: Logging is active");
  17. }
  18. // Set to false to disable traces that appear with warnings
  19. if ( jQuery.migrateTrace === undefined ) {
  20. jQuery.migrateTrace = true;
  21. }
  22. // Forget any warnings we've already given; public
  23. jQuery.migrateReset = function() {
  24. warnedAbout = {};
  25. jQuery.migrateWarnings.length = 0;
  26. };
  27. function migrateWarn( msg) {
  28. var console = window.console;
  29. if ( !warnedAbout[ msg ] ) {
  30. warnedAbout[ msg ] = true;
  31. jQuery.migrateWarnings.push( msg );
  32. if ( console && console.warn && !jQuery.migrateMute ) {
  33. //console.warn( "JQMIGRATE: " + msg );
  34. if ( jQuery.migrateTrace && console.trace ) {
  35. //console.trace();
  36. }
  37. }
  38. }
  39. }
  40. function migrateWarnProp( obj, prop, value, msg ) {
  41. if ( Object.defineProperty ) {
  42. // On ES5 browsers (non-oldIE), warn if the code tries to get prop;
  43. // allow property to be overwritten in case some other plugin wants it
  44. try {
  45. Object.defineProperty( obj, prop, {
  46. configurable: true,
  47. enumerable: true,
  48. get: function() {
  49. migrateWarn( msg );
  50. return value;
  51. },
  52. set: function( newValue ) {
  53. migrateWarn( msg );
  54. value = newValue;
  55. }
  56. });
  57. return;
  58. } catch( err ) {
  59. // IE8 is a dope about Object.defineProperty, can't warn there
  60. }
  61. }
  62. // Non-ES5 (or broken) browser; just set the property
  63. jQuery._definePropertyBroken = true;
  64. obj[ prop ] = value;
  65. }
  66. if ( document.compatMode === "BackCompat" ) {
  67. // jQuery has never supported or tested Quirks Mode
  68. migrateWarn( "jQuery is not compatible with Quirks Mode" );
  69. }
  70. var attrFn = jQuery( "<input/>", { size: 1 } ).attr("size") && jQuery.attrFn,
  71. oldAttr = jQuery.attr,
  72. valueAttrGet = jQuery.attrHooks.value && jQuery.attrHooks.value.get ||
  73. function() { return null; },
  74. valueAttrSet = jQuery.attrHooks.value && jQuery.attrHooks.value.set ||
  75. function() { return undefined; },
  76. rnoType = /^(?:input|button)$/i,
  77. rnoAttrNodeType = /^[238]$/,
  78. rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,
  79. ruseDefault = /^(?:checked|selected)$/i;
  80. // jQuery.attrFn
  81. migrateWarnProp( jQuery, "attrFn", attrFn || {}, "jQuery.attrFn is deprecated" );
  82. jQuery.attr = function( elem, name, value, pass ) {
  83. var lowerName = name.toLowerCase(),
  84. nType = elem && elem.nodeType;
  85. if ( pass ) {
  86. // Since pass is used internally, we only warn for new jQuery
  87. // versions where there isn't a pass arg in the formal params
  88. if ( oldAttr.length < 4 ) {
  89. migrateWarn("jQuery.fn.attr( props, pass ) is deprecated");
  90. }
  91. if ( elem && !rnoAttrNodeType.test( nType ) &&
  92. (attrFn ? name in attrFn : jQuery.isFunction(jQuery.fn[name])) ) {
  93. return jQuery( elem )[ name ]( value );
  94. }
  95. }
  96. // Warn if user tries to set `type`, since it breaks on IE 6/7/8; by checking
  97. // for disconnected elements we don't warn on $( "<button>", { type: "button" } ).
  98. if ( name === "type" && value !== undefined && rnoType.test( elem.nodeName ) && elem.parentNode ) {
  99. migrateWarn("Can't change the 'type' of an input or button in IE 6/7/8");
  100. }
  101. // Restore boolHook for boolean property/attribute synchronization
  102. if ( !jQuery.attrHooks[ lowerName ] && rboolean.test( lowerName ) ) {
  103. jQuery.attrHooks[ lowerName ] = {
  104. get: function( elem, name ) {
  105. // Align boolean attributes with corresponding properties
  106. // Fall back to attribute presence where some booleans are not supported
  107. var attrNode,
  108. property = jQuery.prop( elem, name );
  109. return property === true || typeof property !== "boolean" &&
  110. ( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ?
  111. name.toLowerCase() :
  112. undefined;
  113. },
  114. set: function( elem, value, name ) {
  115. var propName;
  116. if ( value === false ) {
  117. // Remove boolean attributes when set to false
  118. jQuery.removeAttr( elem, name );
  119. } else {
  120. // value is true since we know at this point it's type boolean and not false
  121. // Set boolean attributes to the same name and set the DOM property
  122. propName = jQuery.propFix[ name ] || name;
  123. if ( propName in elem ) {
  124. // Only set the IDL specifically if it already exists on the element
  125. elem[ propName ] = true;
  126. }
  127. elem.setAttribute( name, name.toLowerCase() );
  128. }
  129. return name;
  130. }
  131. };
  132. // Warn only for attributes that can remain distinct from their properties post-1.9
  133. if ( ruseDefault.test( lowerName ) ) {
  134. migrateWarn( "jQuery.fn.attr('" + lowerName + "') may use property instead of attribute" );
  135. }
  136. }
  137. return oldAttr.call( jQuery, elem, name, value );
  138. };
  139. // attrHooks: value
  140. jQuery.attrHooks.value = {
  141. get: function( elem, name ) {
  142. var nodeName = ( elem.nodeName || "" ).toLowerCase();
  143. if ( nodeName === "button" ) {
  144. return valueAttrGet.apply( this, arguments );
  145. }
  146. if ( nodeName !== "input" && nodeName !== "option" ) {
  147. migrateWarn("jQuery.fn.attr('value') no longer gets properties");
  148. }
  149. return name in elem ?
  150. elem.value :
  151. null;
  152. },
  153. set: function( elem, value ) {
  154. var nodeName = ( elem.nodeName || "" ).toLowerCase();
  155. if ( nodeName === "button" ) {
  156. return valueAttrSet.apply( this, arguments );
  157. }
  158. if ( nodeName !== "input" && nodeName !== "option" ) {
  159. migrateWarn("jQuery.fn.attr('value', val) no longer sets properties");
  160. }
  161. // Does not return so that setAttribute is also used
  162. elem.value = value;
  163. }
  164. };
  165. var matched, browser,
  166. oldInit = jQuery.fn.init,
  167. oldParseJSON = jQuery.parseJSON,
  168. // Note: XSS check is done below after string is trimmed
  169. rquickExpr = /^([^<]*)(<[\w\W]+>)([^>]*)$/;
  170. // $(html) "looks like html" rule change
  171. jQuery.fn.init = function( selector, context, rootjQuery ) {
  172. var match;
  173. if ( selector && typeof selector === "string" && !jQuery.isPlainObject( context ) &&
  174. (match = rquickExpr.exec( jQuery.trim( selector ) )) && match[ 0 ] ) {
  175. // This is an HTML string according to the "old" rules; is it still?
  176. if ( selector.charAt( 0 ) !== "<" ) {
  177. migrateWarn("$(html) HTML strings must start with '<' character");
  178. }
  179. if ( match[ 3 ] ) {
  180. migrateWarn("$(html) HTML text after last tag is ignored");
  181. }
  182. // Consistently reject any HTML-like string starting with a hash (#9521)
  183. // Note that this may break jQuery 1.6.x code that otherwise would work.
  184. if ( match[ 0 ].charAt( 0 ) === "#" ) {
  185. migrateWarn("HTML string cannot start with a '#' character");
  186. jQuery.error("JQMIGRATE: Invalid selector string (XSS)");
  187. }
  188. // Now process using loose rules; let pre-1.8 play too
  189. if ( context && context.context ) {
  190. // jQuery object as context; parseHTML expects a DOM object
  191. context = context.context;
  192. }
  193. if ( jQuery.parseHTML ) {
  194. return oldInit.call( this, jQuery.parseHTML( match[ 2 ], context, true ),
  195. context, rootjQuery );
  196. }
  197. }
  198. return oldInit.apply( this, arguments );
  199. };
  200. jQuery.fn.init.prototype = jQuery.fn;
  201. // Let $.parseJSON(falsy_value) return null
  202. jQuery.parseJSON = function( json ) {
  203. if ( !json && json !== null ) {
  204. migrateWarn("jQuery.parseJSON requires a valid JSON string");
  205. return null;
  206. }
  207. return oldParseJSON.apply( this, arguments );
  208. };
  209. jQuery.uaMatch = function( ua ) {
  210. ua = ua.toLowerCase();
  211. var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) ||
  212. /(webkit)[ \/]([\w.]+)/.exec( ua ) ||
  213. /(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) ||
  214. /(msie) ([\w.]+)/.exec( ua ) ||
  215. ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) ||
  216. [];
  217. return {
  218. browser: match[ 1 ] || "",
  219. version: match[ 2 ] || "0"
  220. };
  221. };
  222. // Don't clobber any existing jQuery.browser in case it's different
  223. if ( !jQuery.browser ) {
  224. matched = jQuery.uaMatch( navigator.userAgent );
  225. browser = {};
  226. if ( matched.browser ) {
  227. browser[ matched.browser ] = true;
  228. browser.version = matched.version;
  229. }
  230. // Chrome is Webkit, but Webkit is also Safari.
  231. if ( browser.chrome ) {
  232. browser.webkit = true;
  233. } else if ( browser.webkit ) {
  234. browser.safari = true;
  235. }
  236. jQuery.browser = browser;
  237. }
  238. // Warn if the code tries to get jQuery.browser
  239. migrateWarnProp( jQuery, "browser", jQuery.browser, "jQuery.browser is deprecated" );
  240. jQuery.sub = function() {
  241. function jQuerySub( selector, context ) {
  242. return new jQuerySub.fn.init( selector, context );
  243. }
  244. jQuery.extend( true, jQuerySub, this );
  245. jQuerySub.superclass = this;
  246. jQuerySub.fn = jQuerySub.prototype = this();
  247. jQuerySub.fn.constructor = jQuerySub;
  248. jQuerySub.sub = this.sub;
  249. jQuerySub.fn.init = function init( selector, context ) {
  250. if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) {
  251. context = jQuerySub( context );
  252. }
  253. return jQuery.fn.init.call( this, selector, context, rootjQuerySub );
  254. };
  255. jQuerySub.fn.init.prototype = jQuerySub.fn;
  256. var rootjQuerySub = jQuerySub(document);
  257. migrateWarn( "jQuery.sub() is deprecated" );
  258. return jQuerySub;
  259. };
  260. // Ensure that $.ajax gets the new parseJSON defined in core.js
  261. jQuery.ajaxSetup({
  262. converters: {
  263. "text json": jQuery.parseJSON
  264. }
  265. });
  266. var oldFnData = jQuery.fn.data;
  267. jQuery.fn.data = function( name ) {
  268. var ret, evt,
  269. elem = this[0];
  270. // Handles 1.7 which has this behavior and 1.8 which doesn't
  271. if ( elem && name === "events" && arguments.length === 1 ) {
  272. ret = jQuery.data( elem, name );
  273. evt = jQuery._data( elem, name );
  274. if ( ( ret === undefined || ret === evt ) && evt !== undefined ) {
  275. migrateWarn("Use of jQuery.fn.data('events') is deprecated");
  276. return evt;
  277. }
  278. }
  279. return oldFnData.apply( this, arguments );
  280. };
  281. var rscriptType = /\/(java|ecma)script/i,
  282. oldSelf = jQuery.fn.andSelf || jQuery.fn.addBack;
  283. jQuery.fn.andSelf = function() {
  284. migrateWarn("jQuery.fn.andSelf() replaced by jQuery.fn.addBack()");
  285. return oldSelf.apply( this, arguments );
  286. };
  287. // Since jQuery.clean is used internally on older versions, we only shim if it's missing
  288. if ( !jQuery.clean ) {
  289. jQuery.clean = function( elems, context, fragment, scripts ) {
  290. // Set context per 1.8 logic
  291. context = context || document;
  292. context = !context.nodeType && context[0] || context;
  293. context = context.ownerDocument || context;
  294. migrateWarn("jQuery.clean() is deprecated");
  295. var i, elem, handleScript, jsTags,
  296. ret = [];
  297. jQuery.merge( ret, jQuery.buildFragment( elems, context ).childNodes );
  298. // Complex logic lifted directly from jQuery 1.8
  299. if ( fragment ) {
  300. // Special handling of each script element
  301. handleScript = function( elem ) {
  302. // Check if we consider it executable
  303. if ( !elem.type || rscriptType.test( elem.type ) ) {
  304. // Detach the script and store it in the scripts array (if provided) or the fragment
  305. // Return truthy to indicate that it has been handled
  306. return scripts ?
  307. scripts.push( elem.parentNode ? elem.parentNode.removeChild( elem ) : elem ) :
  308. fragment.appendChild( elem );
  309. }
  310. };
  311. for ( i = 0; (elem = ret[i]) != null; i++ ) {
  312. // Check if we're done after handling an executable script
  313. if ( !( jQuery.nodeName( elem, "script" ) && handleScript( elem ) ) ) {
  314. // Append to fragment and handle embedded scripts
  315. fragment.appendChild( elem );
  316. if ( typeof elem.getElementsByTagName !== "undefined" ) {
  317. // handleScript alters the DOM, so use jQuery.merge to ensure snapshot iteration
  318. jsTags = jQuery.grep( jQuery.merge( [], elem.getElementsByTagName("script") ), handleScript );
  319. // Splice the scripts into ret after their former ancestor and advance our index beyond them
  320. ret.splice.apply( ret, [i + 1, 0].concat( jsTags ) );
  321. i += jsTags.length;
  322. }
  323. }
  324. }
  325. }
  326. return ret;
  327. };
  328. }
  329. var eventAdd = jQuery.event.add,
  330. eventRemove = jQuery.event.remove,
  331. eventTrigger = jQuery.event.trigger,
  332. oldToggle = jQuery.fn.toggle,
  333. oldLive = jQuery.fn.live,
  334. oldDie = jQuery.fn.die,
  335. ajaxEvents = "ajaxStart|ajaxStop|ajaxSend|ajaxComplete|ajaxError|ajaxSuccess",
  336. rajaxEvent = new RegExp( "\\b(?:" + ajaxEvents + ")\\b" ),
  337. rhoverHack = /(?:^|\s)hover(\.\S+|)\b/,
  338. hoverHack = function( events ) {
  339. if ( typeof( events ) !== "string" || jQuery.event.special.hover ) {
  340. return events;
  341. }
  342. if ( rhoverHack.test( events ) ) {
  343. migrateWarn("'hover' pseudo-event is deprecated, use 'mouseenter mouseleave'");
  344. }
  345. return events && events.replace( rhoverHack, "mouseenter$1 mouseleave$1" );
  346. };
  347. // Event props removed in 1.9, put them back if needed; no practical way to warn them
  348. if ( jQuery.event.props && jQuery.event.props[ 0 ] !== "attrChange" ) {
  349. jQuery.event.props.unshift( "attrChange", "attrName", "relatedNode", "srcElement" );
  350. }
  351. // Undocumented jQuery.event.handle was "deprecated" in jQuery 1.7
  352. if ( jQuery.event.dispatch ) {
  353. migrateWarnProp( jQuery.event, "handle", jQuery.event.dispatch, "jQuery.event.handle is undocumented and deprecated" );
  354. }
  355. // Support for 'hover' pseudo-event and ajax event warnings
  356. jQuery.event.add = function( elem, types, handler, data, selector ){
  357. if ( elem !== document && rajaxEvent.test( types ) ) {
  358. migrateWarn( "AJAX events should be attached to document: " + types );
  359. }
  360. eventAdd.call( this, elem, hoverHack( types || "" ), handler, data, selector );
  361. };
  362. jQuery.event.remove = function( elem, types, handler, selector, mappedTypes ){
  363. eventRemove.call( this, elem, hoverHack( types ) || "", handler, selector, mappedTypes );
  364. };
  365. jQuery.fn.error = function() {
  366. var args = Array.prototype.slice.call( arguments, 0);
  367. migrateWarn("jQuery.fn.error() is deprecated");
  368. args.splice( 0, 0, "error" );
  369. if ( arguments.length ) {
  370. return this.bind.apply( this, args );
  371. }
  372. // error event should not bubble to window, although it does pre-1.7
  373. this.triggerHandler.apply( this, args );
  374. return this;
  375. };
  376. jQuery.fn.toggle = function( fn, fn2 ) {
  377. // Don't mess with animation or css toggles
  378. if ( !jQuery.isFunction( fn ) || !jQuery.isFunction( fn2 ) ) {
  379. return oldToggle.apply( this, arguments );
  380. }
  381. migrateWarn("jQuery.fn.toggle(handler, handler...) is deprecated");
  382. // Save reference to arguments for access in closure
  383. var args = arguments,
  384. guid = fn.guid || jQuery.guid++,
  385. i = 0,
  386. toggler = function( event ) {
  387. // Figure out which function to execute
  388. var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i;
  389. jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 );
  390. // Make sure that clicks stop
  391. event.preventDefault();
  392. // and execute the function
  393. return args[ lastToggle ].apply( this, arguments ) || false;
  394. };
  395. // link all the functions, so any of them can unbind this click handler
  396. toggler.guid = guid;
  397. while ( i < args.length ) {
  398. args[ i++ ].guid = guid;
  399. }
  400. return this.click( toggler );
  401. };
  402. jQuery.fn.live = function( types, data, fn ) {
  403. migrateWarn("jQuery.fn.live() is deprecated");
  404. if ( oldLive ) {
  405. return oldLive.apply( this, arguments );
  406. }
  407. jQuery( this.context ).on( types, this.selector, data, fn );
  408. return this;
  409. };
  410. jQuery.fn.die = function( types, fn ) {
  411. migrateWarn("jQuery.fn.die() is deprecated");
  412. if ( oldDie ) {
  413. return oldDie.apply( this, arguments );
  414. }
  415. jQuery( this.context ).off( types, this.selector || "**", fn );
  416. return this;
  417. };
  418. // Turn global events into document-triggered events
  419. jQuery.event.trigger = function( event, data, elem, onlyHandlers ){
  420. if ( !elem && !rajaxEvent.test( event ) ) {
  421. migrateWarn( "Global events are undocumented and deprecated" );
  422. }
  423. return eventTrigger.call( this, event, data, elem || document, onlyHandlers );
  424. };
  425. jQuery.each( ajaxEvents.split("|"),
  426. function( _, name ) {
  427. jQuery.event.special[ name ] = {
  428. setup: function() {
  429. var elem = this;
  430. // The document needs no shimming; must be !== for oldIE
  431. if ( elem !== document ) {
  432. jQuery.event.add( document, name + "." + jQuery.guid, function() {
  433. jQuery.event.trigger( name, null, elem, true );
  434. });
  435. jQuery._data( this, name, jQuery.guid++ );
  436. }
  437. return false;
  438. },
  439. teardown: function() {
  440. if ( this !== document ) {
  441. jQuery.event.remove( document, name + "." + jQuery._data( this, name ) );
  442. }
  443. return false;
  444. }
  445. };
  446. }
  447. );
  448. })( jQuery, window );

3.index.html

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>JQeury实现表格行列冻结3</title>
  6. <style type='text/css'>
  7. table{empty-cells:show;border-collapse:collapse;border-spacing:0}
  8. table{font-family:宋体; font-size:10pt;border:1px green solid;background-color:white;}
  9. table td{height:20px;text-align:center;border:1px green solid;}
  10. table .tabTh{color:green;font-weight:bold;background-color:#f1faee;}
  11. </style>
  12. <script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
  13. <script type="text/javascript" src="js/jquery-migrate-1.2.1.js"></script>
  14. <script type="text/javascript" src="js/TableFreeze.js"></script>
  15. <script type='text/javascript'>
  16. $(document).ready(function(){
  17. $("#tab_Test1").FrozenTable(2,0,0);
  18. $("#tab_Test2").FrozenTable(0,0,1);
  19. $("#tab_Test3").FrozenTable(1,0,1);
  20. $("#tab_Test4").FrozenTable(2,1,1);
  21. $("#tab_Test5").FrozenTable(3,1,4);
  22. $("#tab_Test6").FrozenTable(2,1,2);
  23. $("#tab_Test7").FrozenTable(2,2,1);
  24. });
  25. </script>
  26. </head>
  27. <body>
  28. <!--**************************************-->
  29. <h3>例0:原始表格上加滚动条效果;</h3>
  30. <div style="overflow:auto;width:920px;height:229px;">
  31. <table id="tab_Test0" border="1" width='900'>
  32. <tr class='tabTh'>
  33. <td width="100px">序号</td>
  34. <td width="100px">用户名</td>
  35. <td width="100px">姓名</td>
  36. <td width="100px">归属机构</td>
  37. <td width="100px">密码</td>
  38. <td width="100px">用户类型</td>
  39. <td width="200px">状 态(0无效/1有效)</td>
  40. <td width="100px">备注</td>
  41. </tr>
  42. <tr align='center'>
  43. <td><input type=checkbox>1</td>
  44. <td>admin</td>
  45. <td>admin</td>
  46. <td>9</td>
  47. <td>******</td>
  48. <td>系统管理员</td>
  49. <td>1</td>
  50. <td>it管理员</td>
  51. </tr>
  52. <tr align='center'>
  53. <td><input type=checkbox>2</td>
  54. <td>admin2</td>
  55. <td>admin2</td>
  56. <td>92</td>
  57. <td>******</td>
  58. <td>系统管理员2</td>
  59. <td>1</td>
  60. <td>it管理员2</td>
  61. </tr>
  62. <tr align='center'>
  63. <td><input type=checkbox>3</td>
  64. <td>admin3</td>
  65. <td>admin3</td>
  66. <td>93</td>
  67. <td>******</td>
  68. <td>系统管理员3</td>
  69. <td>1</td>
  70. <td>it管理员3</td>
  71. </tr>
  72. <tr align='center'>
  73. <td><input type=checkbox>4</td>
  74. <td>admin4</td>
  75. <td>admin4</td>
  76. <td>9</td>
  77. <td>******</td>
  78. <td>系统管理员4</td>
  79. <td>14</td>
  80. <td>it管理员4</td>
  81. </tr>
  82. <tr align='center'>
  83. <td><input type=checkbox>5</td>
  84. <td>admin5</td>
  85. <td>admin5</td>
  86. <td>95</td>
  87. <td>******</td>
  88. <td>系统管理员</td>
  89. <td>1</td>
  90. <td>it管理员</td>
  91. </tr>
  92. <tr align='center'>
  93. <td><input type=checkbox>6</td>
  94. <td>admin6</td>
  95. <td>admin6</td>
  96. <td>9</td>
  97. <td>******</td>
  98. <td>系统管理员6</td>
  99. <td>1</td>
  100. <td>it管理员6</td>
  101. </tr>
  102. <tr align='center'>
  103. <td><input type=checkbox>7</td>
  104. <td>admin7</td>
  105. <td>admin7</td>
  106. <td>7</td>
  107. <td>******</td>
  108. <td>系统管理员7</td>
  109. <td>1</td>
  110. <td>it管理员7</td>
  111. </tr>
  112. <tr align='center'>
  113. <td><input type=checkbox>8</td>
  114. <td>admin8</td>
  115. <td>admin8</td>
  116. <td>9</td>
  117. <td>******</td>
  118. <td>系统管理员8</td>
  119. <td>1</td>
  120. <td>it管理员8</td>
  121. </tr>
  122. <tr align='center'>
  123. <td><input type=checkbox>9</td>
  124. <td>admin9</td>
  125. <td>admin9</td>
  126. <td>9</td>
  127. <td>******</td>
  128. <td>系统管理员</td>
  129. <td>1</td>
  130. <td>it管理员</td>
  131. </tr>
  132. <tr align='center'>
  133. <td><input type=checkbox>10</td>
  134. <td>admin10</td>
  135. <td>admin</td>
  136. <td>9</td>
  137. <td>******</td>
  138. <td>系统管理员10</td>
  139. <td>1</td>
  140. <td>it管理员</td>
  141. </tr>
  142. <tr align='center'>
  143. <td><input type=checkbox>11</td>
  144. <td>admin11</td>
  145. <td>admin11</td>
  146. <td>9</td>
  147. <td>******</td>
  148. <td>系统管理员11</td>
  149. <td>1</td>
  150. <td>it管理员11</td>
  151. </tr>
  152. <tr align='center'>
  153. <td><input type=checkbox>12</td>
  154. <td>admin12</td>
  155. <td>admin12</td>
  156. <td>9</td>
  157. <td>******</td>
  158. <td>系统管理员12</td>
  159. <td>1</td>
  160. <td>it管理员</td>
  161. </tr>
  162. <tr align='center'>
  163. <td><input type=checkbox>13</td>
  164. <td>admin</td>
  165. <td>admin</td>
  166. <td>9</td>
  167. <td>******</td>
  168. <td>系统管理员</td>
  169. <td>1</td>
  170. <td>it管理员</td>
  171. </tr>
  172. <tr align='center'>
  173. <td><input type=checkbox>14</td>
  174. <td>admin4</td>
  175. <td>admin4</td>
  176. <td>9</td>
  177. <td>******</td>
  178. <td>系统管理员4</td>
  179. <td>1</td>
  180. <td>it管理员</td>
  181. </tr>
  182. <tr align='center'>
  183. <td><input type=checkbox>15</td>
  184. <td>admin</td>
  185. <td>admin</td>
  186. <td>9</td>
  187. <td>******</td>
  188. <td>系统管理员5</td>
  189. <td>1</td>
  190. <td>it管理员5</td>
  191. </tr>
  192. <tr align='center'>
  193. <td><input type=checkbox>16</td>
  194. <td>admin</td>
  195. <td>admin6</td>
  196. <td>9</td>
  197. <td>******</td>
  198. <td>系统管理6</td>
  199. <td>1</td>
  200. <td>it管理员6</td>
  201. </tr>
  202. <tr align='center'>
  203. <td><input type=checkbox>17</td>
  204. <td>admin</td>
  205. <td>admin</td>
  206. <td>9</td>
  207. <td>******</td>
  208. <td>系统管理员</td>
  209. <td>1</td>
  210. <td>it管理员</td>
  211. </tr>
  212. <tr align='center'>
  213. <td><input type=checkbox>18</td>
  214. <td>admin</td>
  215. <td>admin</td>
  216. <td>9</td>
  217. <td>******</td>
  218. <td>系统管理员</td>
  219. <td>1</td>
  220. <td>it管理员</td>
  221. </tr>
  222. <tr align='center'>
  223. <td><input type=checkbox>19</td>
  224. <td>admin19</td>
  225. <td>admin19</td>
  226. <td>9</td>
  227. <td>******</td>
  228. <td>系统管理员</td>
  229. <td>1</td>
  230. <td>it管理员</td>
  231. </tr>
  232. <tr align='center'>
  233. <td><input type=checkbox>20</td>
  234. <td>admin20</td>
  235. <td>admin20</td>
  236. <td>9</td>
  237. <td>******</td>
  238. <td>系统管理员</td>
  239. <td>1</td>
  240. <td>it管理员</td>
  241. </tr>
  242. </table>
  243. </div>
  244. <hr>
  245. <!--**************************************-->
  246. <h3>例一:2行固定 $("#tab_Test1").FrozenTable(2,0,0);</h3>
  247. <div style="OVERFLOW: auto;width:920px;height:229px;">
  248. <table id="tab_Test1" border="1" width='900'>
  249. <tr class='tabTh'>
  250. <td colspan='8'>用户列表</td>
  251. </tr>
  252. <tr class='tabTh'>
  253. <td width="100px">序号</td>
  254. <td width="100px">用户名</td>
  255. <td width="100px">姓名</td>
  256. <td width="100px">归属机构</td>
  257. <td width="100px">密码</td>
  258. <td width="100px">用户类型</td>
  259. <td width="200px">状 态(0无效/1有效)</td>
  260. <td width="100px">备注</td>
  261. </tr>
  262. <tr align='center'>
  263. <td><input type=checkbox>1</td>
  264. <td>admin</td>
  265. <td>admin</td>
  266. <td>9</td>
  267. <td>******</td>
  268. <td>系统管理员</td>
  269. <td>1</td>
  270. <td>it管理员</td>
  271. </tr>
  272. <tr align='center'>
  273. <td><input type=checkbox>2</td>
  274. <td>admin2</td>
  275. <td>admin2</td>
  276. <td>92</td>
  277. <td>******</td>
  278. <td>系统管理员2</td>
  279. <td>1</td>
  280. <td>it管理员2</td>
  281. </tr>
  282. <tr align='center'>
  283. <td><input type=checkbox>3</td>
  284. <td>admin3</td>
  285. <td>admin3</td>
  286. <td>93</td>
  287. <td>******</td>
  288. <td>系统管理员3</td>
  289. <td>1</td>
  290. <td>it管理员3</td>
  291. </tr>
  292. <tr align='center'>
  293. <td><input type=checkbox>4</td>
  294. <td>admin4</td>
  295. <td>admin4</td>
  296. <td>9</td>
  297. <td>******</td>
  298. <td>系统管理员4</td>
  299. <td>14</td>
  300. <td>it管理员4</td>
  301. </tr>
  302. <tr align='center'>
  303. <td><input type=checkbox>5</td>
  304. <td>admin5</td>
  305. <td>admin5</td>
  306. <td>95</td>
  307. <td>******</td>
  308. <td>系统管理员</td>
  309. <td>1</td>
  310. <td>it管理员</td>
  311. </tr>
  312. <tr align='center'>
  313. <td><input type=checkbox>6</td>
  314. <td>admin6</td>
  315. <td>admin6</td>
  316. <td>9</td>
  317. <td>******</td>
  318. <td>系统管理员6</td>
  319. <td>1</td>
  320. <td>it管理员6</td>
  321. </tr>
  322. <tr align='center'>
  323. <td><input type=checkbox>7</td>
  324. <td>admin7</td>
  325. <td>admin7</td>
  326. <td>7</td>
  327. <td>******</td>
  328. <td>系统管理员7</td>
  329. <td>1</td>
  330. <td>it管理员7</td>
  331. </tr>
  332. <tr align='center'>
  333. <td><input type=checkbox>8</td>
  334. <td>admin8</td>
  335. <td>admin8</td>
  336. <td>9</td>
  337. <td>******</td>
  338. <td>系统管理员8</td>
  339. <td>1</td>
  340. <td>it管理员8</td>
  341. </tr>
  342. <tr align='center'>
  343. <td><input type=checkbox>9</td>
  344. <td>admin9</td>
  345. <td>admin9</td>
  346. <td>9</td>
  347. <td>******</td>
  348. <td>系统管理员</td>
  349. <td>1</td>
  350. <td>it管理员</td>
  351. </tr>
  352. <tr align='center'>
  353. <td><input type=checkbox>10</td>
  354. <td>admin10</td>
  355. <td>admin</td>
  356. <td>9</td>
  357. <td>******</td>
  358. <td>系统管理员10</td>
  359. <td>1</td>
  360. <td>it管理员</td>
  361. </tr>
  362. <tr align='center'>
  363. <td><input type=checkbox>11</td>
  364. <td>admin11</td>
  365. <td>admin11</td>
  366. <td>9</td>
  367. <td>******</td>
  368. <td>系统管理员11</td>
  369. <td>1</td>
  370. <td>it管理员11</td>
  371. </tr>
  372. <tr align='center'>
  373. <td><input type=checkbox>12</td>
  374. <td>admin12</td>
  375. <td>admin12</td>
  376. <td>9</td>
  377. <td>******</td>
  378. <td>系统管理员12</td>
  379. <td>1</td>
  380. <td>it管理员</td>
  381. </tr>
  382. <tr align='center'>
  383. <td><input type=checkbox>13</td>
  384. <td>admin</td>
  385. <td>admin</td>
  386. <td>9</td>
  387. <td>******</td>
  388. <td>系统管理员</td>
  389. <td>1</td>
  390. <td>it管理员</td>
  391. </tr>
  392. <tr align='center'>
  393. <td><input type=checkbox>14</td>
  394. <td>admin4</td>
  395. <td>admin4</td>
  396. <td>9</td>
  397. <td>******</td>
  398. <td>系统管理员4</td>
  399. <td>1</td>
  400. <td>it管理员</td>
  401. </tr>
  402. <tr align='center'>
  403. <td><input type=checkbox>15</td>
  404. <td>admin</td>
  405. <td>admin</td>
  406. <td>9</td>
  407. <td>******</td>
  408. <td>系统管理员5</td>
  409. <td>1</td>
  410. <td>it管理员5</td>
  411. </tr>
  412. <tr align='center'>
  413. <td><input type=checkbox>16</td>
  414. <td>admin</td>
  415. <td>admin6</td>
  416. <td>9</td>
  417. <td>******</td>
  418. <td>系统管理6</td>
  419. <td>1</td>
  420. <td>it管理员6</td>
  421. </tr>
  422. <tr align='center'>
  423. <td><input type=checkbox>17</td>
  424. <td>admin</td>
  425. <td>admin</td>
  426. <td>9</td>
  427. <td>******</td>
  428. <td>系统管理员</td>
  429. <td>1</td>
  430. <td>it管理员</td>
  431. </tr>
  432. <tr align='center'>
  433. <td><input type=checkbox>18</td>
  434. <td>admin</td>
  435. <td>admin</td>
  436. <td>9</td>
  437. <td>******</td>
  438. <td>系统管理员</td>
  439. <td>1</td>
  440. <td>it管理员</td>
  441. </tr>
  442. <tr align='center'>
  443. <td><input type=checkbox>19</td>
  444. <td>admin19</td>
  445. <td>admin19</td>
  446. <td>9</td>
  447. <td>******</td>
  448. <td>系统管理员</td>
  449. <td>1</td>
  450. <td>it管理员</td>
  451. </tr>
  452. <tr align='center'>
  453. <td><input type=checkbox>20</td>
  454. <td>admin20</td>
  455. <td>admin20</td>
  456. <td>9</td>
  457. <td>******</td>
  458. <td>系统管理员</td>
  459. <td>1</td>
  460. <td>it管理员</td>
  461. </tr>
  462. </table>
  463. </div>
  464. <hr>
  465. <!--**************************************-->
  466. <h3>例二:0行1列固定 $("#tab_Test2").FrozenTable(0,0,1);</h3>
  467. <div style="OVERFLOW: auto;width:718px;height:229px;">
  468. <table id="tab_Test2" border="1" width='900'>
  469. <tr class='tabTh'>
  470. <td width="100px">序号</td>
  471. <td width="100px">用户名</td>
  472. <td width="100px">姓名</td>
  473. <td width="100px">归属机构</td>
  474. <td width="100px">密码</td>
  475. <td width="100px">用户类型</td>
  476. <td width="200px">状 态(0无效/1有效)</td>
  477. <td width="100px">备注</td>
  478. </tr>
  479. <tr align='center'>
  480. <td><input type=checkbox>1</td>
  481. <td>admin</td>
  482. <td>admin</td>
  483. <td>9</td>
  484. <td>******</td>
  485. <td>系统管理员</td>
  486. <td>1</td>
  487. <td>it管理员</td>
  488. </tr>
  489. <tr align='center'>
  490. <td><input type=checkbox>2</td>
  491. <td>admin2</td>
  492. <td>admin2</td>
  493. <td>92</td>
  494. <td>******</td>
  495. <td>系统管理员2</td>
  496. <td>1</td>
  497. <td>it管理员2</td>
  498. </tr>
  499. <tr align='center'>
  500. <td><input type=checkbox>3</td>
  501. <td>admin3</td>
  502. <td>admin3</td>
  503. <td>93</td>
  504. <td>******</td>
  505. <td>系统管理员3</td>
  506. <td>1</td>
  507. <td>it管理员3</td>
  508. </tr>
  509. <tr align='center'>
  510. <td><input type=checkbox>4</td>
  511. <td>admin4</td>
  512. <td>admin4</td>
  513. <td>9</td>
  514. <td>******</td>
  515. <td>系统管理员4</td>
  516. <td>14</td>
  517. <td>it管理员4</td>
  518. </tr>
  519. <tr align='center'>
  520. <td><input type=checkbox>5</td>
  521. <td>admin5</td>
  522. <td>admin5</td>
  523. <td>95</td>
  524. <td>******</td>
  525. <td>系统管理员</td>
  526. <td>1</td>
  527. <td>it管理员</td>
  528. </tr>
  529. <tr align='center'>
  530. <td><input type=checkbox>6</td>
  531. <td>admin6</td>
  532. <td>admin6</td>
  533. <td>9</td>
  534. <td>******</td>
  535. <td>系统管理员6</td>
  536. <td>1</td>
  537. <td>it管理员6</td>
  538. </tr>
  539. <tr align='center'>
  540. <td><input type=checkbox>7</td>
  541. <td>admin7</td>
  542. <td>admin7</td>
  543. <td>7</td>
  544. <td>******</td>
  545. <td>系统管理员7</td>
  546. <td>1</td>
  547. <td>it管理员7</td>
  548. </tr>
  549. <tr align='center'>
  550. <td><input type=checkbox>8</td>
  551. <td>admin8</td>
  552. <td>admin8</td>
  553. <td>9</td>
  554. <td>******</td>
  555. <td>系统管理员8</td>
  556. <td>1</td>
  557. <td>it管理员8</td>
  558. </tr>
  559. <tr align='center'>
  560. <td><input type=checkbox>9</td>
  561. <td>admin9</td>
  562. <td>admin9</td>
  563. <td>9</td>
  564. <td>******</td>
  565. <td>系统管理员</td>
  566. <td>1</td>
  567. <td>it管理员</td>
  568. </tr>
  569. <tr align='center'>
  570. <td><input type=checkbox>10</td>
  571. <td>admin10</td>
  572. <td>admin</td>
  573. <td>9</td>
  574. <td>******</td>
  575. <td>系统管理员10</td>
  576. <td>1</td>
  577. <td>it管理员</td>
  578. </tr>
  579. <tr align='center'>
  580. <td><input type=checkbox>11</td>
  581. <td>admin11</td>
  582. <td>admin11</td>
  583. <td>9</td>
  584. <td>******</td>
  585. <td>系统管理员11</td>
  586. <td>1</td>
  587. <td>it管理员11</td>
  588. </tr>
  589. <tr align='center'>
  590. <td><input type=checkbox>12</td>
  591. <td>admin12</td>
  592. <td>admin12</td>
  593. <td>9</td>
  594. <td>******</td>
  595. <td>系统管理员12</td>
  596. <td>1</td>
  597. <td>it管理员</td>
  598. </tr>
  599. <tr align='center'>
  600. <td><input type=checkbox>13</td>
  601. <td>admin</td>
  602. <td>admin</td>
  603. <td>9</td>
  604. <td>******</td>
  605. <td>系统管理员</td>
  606. <td>1</td>
  607. <td>it管理员</td>
  608. </tr>
  609. <tr align='center'>
  610. <td><input type=checkbox>14</td>
  611. <td>admin4</td>
  612. <td>admin4</td>
  613. <td>9</td>
  614. <td>******</td>
  615. <td>系统管理员4</td>
  616. <td>1</td>
  617. <td>it管理员</td>
  618. </tr>
  619. <tr align='center'>
  620. <td><input type=checkbox>15</td>
  621. <td>admin</td>
  622. <td>admin</td>
  623. <td>9</td>
  624. <td>******</td>
  625. <td>系统管理员5</td>
  626. <td>1</td>
  627. <td>it管理员5</td>
  628. </tr>
  629. <tr align='center'>
  630. <td><input type=checkbox>16</td>
  631. <td>admin</td>
  632. <td>admin6</td>
  633. <td>9</td>
  634. <td>******</td>
  635. <td>系统管理6</td>
  636. <td>1</td>
  637. <td>it管理员6</td>
  638. </tr>
  639. <tr align='center'>
  640. <td><input type=checkbox>17</td>
  641. <td>admin</td>
  642. <td>admin</td>
  643. <td>9</td>
  644. <td>******</td>
  645. <td>系统管理员</td>
  646. <td>1</td>
  647. <td>it管理员</td>
  648. </tr>
  649. <tr align='center'>
  650. <td><input type=checkbox>18</td>
  651. <td>admin</td>
  652. <td>admin</td>
  653. <td>9</td>
  654. <td>******</td>
  655. <td>系统管理员</td>
  656. <td>1</td>
  657. <td>it管理员</td>
  658. </tr>
  659. <tr align='center'>
  660. <td><input type=checkbox>19</td>
  661. <td>admin19</td>
  662. <td>admin19</td>
  663. <td>9</td>
  664. <td>******</td>
  665. <td>系统管理员</td>
  666. <td>1</td>
  667. <td>it管理员</td>
  668. </tr>
  669. <tr align='center'>
  670. <td><input type=checkbox>20</td>
  671. <td>admin20</td>
  672. <td>admin20</td>
  673. <td>9</td>
  674. <td>******</td>
  675. <td>系统管理员</td>
  676. <td>1</td>
  677. <td>it管理员</td>
  678. </tr>
  679. </table>
  680. </div>
  681. <hr>
  682. <!--**************************************-->
  683. <h3>例三:1行1列固定 $("#tab_Test3").FrozenTable(1,0,1);</h3>
  684. <div id="div_Test3" style="OVERFLOW: auto;width:718px;height:229px;padding:0px">
  685. <table id="tab_Test3" border="1" width='900'>
  686. <tr class='tabTh'>
  687. <td width="100px">序号</td>
  688. <td width="100px">用户名</td>
  689. <td width="100px">姓名</td>
  690. <td width="100px">归属机构</td>
  691. <td width="100px">密码</td>
  692. <td width="100px">用户类型</td>
  693. <td width="200px">状 态(0无效/1有效)</td>
  694. <td width="100px">备注</td>
  695. </tr>
  696. <tr align='center'>
  697. <td><input type=checkbox>1</td>
  698. <td>admin</td>
  699. <td>admin</td>
  700. <td>9</td>
  701. <td>******</td>
  702. <td>系统管理员</td>
  703. <td>1</td>
  704. <td>it管理员</td>
  705. </tr>
  706. <tr align='center'>
  707. <td><input type=checkbox>2</td>
  708. <td>admin2</td>
  709. <td>admin2</td>
  710. <td>92</td>
  711. <td>******</td>
  712. <td>系统管理员2</td>
  713. <td>1</td>
  714. <td>it管理员2</td>
  715. </tr>
  716. <tr align='center'>
  717. <td><input type=checkbox>3</td>
  718. <td>admin3</td>
  719. <td>admin3</td>
  720. <td>93</td>
  721. <td>******</td>
  722. <td>系统管理员3</td>
  723. <td>1</td>
  724. <td>it管理员3</td>
  725. </tr>
  726. <tr align='center'>
  727. <td><input type=checkbox>4</td>
  728. <td>admin4</td>
  729. <td>admin4</td>
  730. <td>9</td>
  731. <td>******</td>
  732. <td>系统管理员4</td>
  733. <td>14</td>
  734. <td>it管理员4</td>
  735. </tr>
  736. <tr align='center'>
  737. <td><input type=checkbox>5</td>
  738. <td>admin5</td>
  739. <td>admin5</td>
  740. <td>95</td>
  741. <td>******</td>
  742. <td>系统管理员</td>
  743. <td>1</td>
  744. <td>it管理员</td>
  745. </tr>
  746. <tr align='center'>
  747. <td><input type=checkbox>6</td>
  748. <td>admin6</td>
  749. <td>admin6</td>
  750. <td>9</td>
  751. <td>******</td>
  752. <td>系统管理员6</td>
  753. <td>1</td>
  754. <td>it管理员6</td>
  755. </tr>
  756. <tr align='center'>
  757. <td><input type=checkbox>7</td>
  758. <td>admin7</td>
  759. <td>admin7</td>
  760. <td>7</td>
  761. <td>******</td>
  762. <td>系统管理员7</td>
  763. <td>1</td>
  764. <td>it管理员7</td>
  765. </tr>
  766. <tr align='center'>
  767. <td><input type=checkbox>8</td>
  768. <td>admin8</td>
  769. <td>admin8</td>
  770. <td>9</td>
  771. <td>******</td>
  772. <td>系统管理员8</td>
  773. <td>1</td>
  774. <td>it管理员8</td>
  775. </tr>
  776. <tr align='center'>
  777. <td><input type=checkbox>9</td>
  778. <td>admin9</td>
  779. <td>admin9</td>
  780. <td>9</td>
  781. <td>******</td>
  782. <td>系统管理员</td>
  783. <td>1</td>
  784. <td>it管理员</td>
  785. </tr>
  786. <tr align='center'>
  787. <td><input type=checkbox>10</td>
  788. <td>admin10</td>
  789. <td>admin</td>
  790. <td>9</td>
  791. <td>******</td>
  792. <td>系统管理员10</td>
  793. <td>1</td>
  794. <td>it管理员</td>
  795. </tr>
  796. <tr align='center'>
  797. <td><input type=checkbox>11</td>
  798. <td>admin11</td>
  799. <td>admin11</td>
  800. <td>9</td>
  801. <td>******</td>
  802. <td>系统管理员11</td>
  803. <td>1</td>
  804. <td>it管理员11</td>
  805. </tr>
  806. <tr align='center'>
  807. <td><input type=checkbox>12</td>
  808. <td>admin12</td>
  809. <td>admin12</td>
  810. <td>9</td>
  811. <td>******</td>
  812. <td>系统管理员12</td>
  813. <td>1</td>
  814. <td>it管理员</td>
  815. </tr>
  816. <tr align='center'>
  817. <td><input type=checkbox>13</td>
  818. <td>admin</td>
  819. <td>admin</td>
  820. <td>9</td>
  821. <td>******</td>
  822. <td>系统管理员</td>
  823. <td>1</td>
  824. <td>it管理员</td>
  825. </tr>
  826. <tr align='center'>
  827. <td><input type=checkbox>14</td>
  828. <td>admin4</td>
  829. <td>admin4</td>
  830. <td>9</td>
  831. <td>******</td>
  832. <td>系统管理员4</td>
  833. <td>1</td>
  834. <td>it管理员</td>
  835. </tr>
  836. <tr align='center'>
  837. <td><input type=checkbox>15</td>
  838. <td>admin</td>
  839. <td>admin</td>
  840. <td>9</td>
  841. <td>******</td>
  842. <td>系统管理员5</td>
  843. <td>1</td>
  844. <td>it管理员5</td>
  845. </tr>
  846. <tr align='center'>
  847. <td><input type=checkbox>16</td>
  848. <td>admin</td>
  849. <td>admin6</td>
  850. <td>9</td>
  851. <td>******</td>
  852. <td>系统管理6</td>
  853. <td>1</td>
  854. <td>it管理员6</td>
  855. </tr>
  856. <tr align='center'>
  857. <td><input type=checkbox>17</td>
  858. <td>admin</td>
  859. <td>admin</td>
  860. <td>9</td>
  861. <td>******</td>
  862. <td>系统管理员</td>
  863. <td>1</td>
  864. <td>it管理员</td>
  865. </tr>
  866. <tr align='center'>
  867. <td><input type=checkbox>18</td>
  868. <td>admin</td>
  869. <td>admin</td>
  870. <td>9</td>
  871. <td>******</td>
  872. <td>系统管理员</td>
  873. <td>1</td>
  874. <td>it管理员</td>
  875. </tr>
  876. <tr align='center'>
  877. <td><input type=checkbox>19</td>
  878. <td>admin19</td>
  879. <td>admin19</td>
  880. <td>9</td>
  881. <td>******</td>
  882. <td>系统管理员</td>
  883. <td>1</td>
  884. <td>it管理员</td>
  885. </tr>
  886. <tr align='center'>
  887. <td><input type=checkbox>20</td>
  888. <td>admin20</td>
  889. <td>admin20</td>
  890. <td>9</td>
  891. <td>******</td>
  892. <td>系统管理员</td>
  893. <td>1</td>
  894. <td>it管理员</td>
  895. </tr>
  896. </table>
  897. </div>
  898. <hr>
  899. <!--**************************************-->
  900. <h3>例四:上2行下1行1列固定 $("#tab_Test4").FrozenTable(2,1,1);</h3>
  901. <div style="OVERFLOW: auto;width:518px;height:228px;">
  902. <table id="tab_Test4" border="1" width='800'>
  903. <tbody>
  904. <tr class='tabTh'>
  905. <td rowspan=2 width="200" >评估险类</td>
  906. <td colspan=3>再保前</td>
  907. <td colspan=3>再保后</td>
  908. </tr>
  909. <tr class='tabTh'>
  910. <td width="100" >评估</td>
  911. <td width="100">分摊</td>
  912. <td width="100">差异</td>
  913. <td width="100">评估</td>
  914. <td width="100">分摊</td>
  915. <td width="100">差异</td>
  916. </tr>
  917. <tr>
  918. <td>106T-保证保险</td>
  919. <td>12312.1</td>
  920. <td>122341</td>
  921. <td>45645.45</td>
  922. <td>6786.6</td>
  923. <td>2345.43</td>
  924. <td>6755.56</td>
  925. </tr>
  926. <tr>
  927. <td>107T-车险(交强险)</td>
  928. <td>12312.1</td>
  929. <td>122341</td>
  930. <td>45645.45</td>
  931. <td>6786.6</td>
  932. <td>2345.43</td>
  933. <td>6755.56</td>
  934. </tr>
  935. <tr>
  936. <td>108T-车险(商业险)</td>
  937. <td>12312.1</td>
  938. <td>122341</td>
  939. <td>45645.45</td>
  940. <td>6786.6</td>
  941. <td>2345.43</td>
  942. <td>6755.56</td>
  943. </tr>
  944. <tr>
  945. <td>109T-房屋险</td>
  946. <td>12312.1</td>
  947. <td>122341</td>
  948. <td>45645.45</td>
  949. <td>6786.6</td>
  950. <td>2345.43</td>
  951. <td>6755.56</td>
  952. </tr>
  953. <tr>
  954. <td>110T-工程险</td>
  955. <td>12312.1</td>
  956. <td>122341</td>
  957. <td>45645.45</td>
  958. <td>6786.6</td>
  959. <td>2345.43</td>
  960. <td>6755.56</td>
  961. </tr>
  962. <tr>
  963. <td>111T-航空险</td>
  964. <td>12312.1</td>
  965. <td>122341</td>
  966. <td>45645.45</td>
  967. <td>6786.6</td>
  968. <td>2345.43</td>
  969. <td>6755.56</td>
  970. </tr>
  971. <tr>
  972. <td>112T-核能保险</td>
  973. <td>12312.1</td>
  974. <td>122341</td>
  975. <td>45645.45</td>
  976. <td>6786.6</td>
  977. <td>2345.43</td>
  978. <td>6755.56</td>
  979. </tr>
  980. <tr>
  981. <td>113T-货运险</td>
  982. <td>12312.1</td>
  983. <td>122341</td>
  984. <td>45645.45</td>
  985. <td>6786.6</td>
  986. <td>2345.43</td>
  987. <td>6755.56</td>
  988. </tr>
  989. <tr>
  990. <td>114T-机损险</td>
  991. <td>12312.1</td>
  992. <td>122341</td>
  993. <td>45645.45</td>
  994. <td>6786.6</td>
  995. <td>2345.43</td>
  996. <td>6755.56</td>
  997. </tr>
  998. <tr>
  999. <td>115T-家财_网络运输</td>
  1000. <td>12312.1</td>
  1001. <td>122341</td>
  1002. <td>45645.45</td>
  1003. <td>6786.6</td>
  1004. <td>2345.43</td>
  1005. <td>6755.56</td>
  1006. </tr>
  1007. <tr>
  1008. <td>116T-健康险</td>
  1009. <td>12312.1</td>
  1010. <td>122341</td>
  1011. <td>45645.45</td>
  1012. <td>6786.6</td>
  1013. <td>2345.43</td>
  1014. <td>6755.56</td>
  1015. </tr>
  1016. <tr>
  1017. <td>118T-农业保险</td>
  1018. <td>12312.1</td>
  1019. <td>122341</td>
  1020. <td>45645.45</td>
  1021. <td>6786.6</td>
  1022. <td>2345.43</td>
  1023. <td>6755.56</td>
  1024. </tr>
  1025. <tr>
  1026. <td>119T-其他险</td>
  1027. <td>12312.1</td>
  1028. <td>122341</td>
  1029. <td>45645.45</td>
  1030. <td>6786.6</td>
  1031. <td>2345.43</td>
  1032. <td>6755.56</td>
  1033. </tr>
  1034. <tr>
  1035. <td>120T-企财险</td>
  1036. <td>12312.1</td>
  1037. <td>122341</td>
  1038. <td>45645.45</td>
  1039. <td>6786.6</td>
  1040. <td>2345.43</td>
  1041. <td>6755.56</td>
  1042. </tr>
  1043. <tr>
  1044. <td>121T-石油保险</td>
  1045. <td>12312.1</td>
  1046. <td>122341</td>
  1047. <td>45645.45</td>
  1048. <td>6786.6</td>
  1049. <td>2345.43</td>
  1050. <td>6755.56</td>
  1051. </tr>
  1052. <tr>
  1053. <td>122T-责任险D&O</td>
  1054. <td>12312.1</td>
  1055. <td>122341</td>
  1056. <td>45645.45</td>
  1057. <td>6786.6</td>
  1058. <td>2345.43</td>
  1059. <td>6755.56</td>
  1060. </tr>
  1061. <tr>
  1062. <td>123T-责任险EPL</td>
  1063. <td>12312.1</td>
  1064. <td>122341</td>
  1065. <td>45645.45</td>
  1066. <td>6786.6</td>
  1067. <td>2345.43</td>
  1068. <td>6755.56</td>
  1069. </tr>
  1070. <tr>
  1071. <td>124T-责任险</td>
  1072. <td>12312.1</td>
  1073. <td>122341</td>
  1074. <td>45645.45</td>
  1075. <td>6786.6</td>
  1076. <td>2345.43</td>
  1077. <td>6755.56</td>
  1078. </tr>
  1079. <tr>
  1080. <td>125T-船舶险</td>
  1081. <td>12312.1</td>
  1082. <td>122341</td>
  1083. <td>45645.45</td>
  1084. <td>6786.6</td>
  1085. <td>2345.43</td>
  1086. <td>6755.56</td>
  1087. </tr>
  1088. <tr>
  1089. <td>126T-意外险</td>
  1090. <td>12312.1</td>
  1091. <td>122341</td>
  1092. <td>45645.45</td>
  1093. <td>6786.6</td>
  1094. <td>2345.43</td>
  1095. <td>6755.56</td>
  1096. </tr>
  1097. <tr>
  1098. <td>127T-家财险</td>
  1099. <td>12312.1</td>
  1100. <td>122341</td>
  1101. <td>45645.45</td>
  1102. <td>6786.6</td>
  1103. <td>2345.43</td>
  1104. <td>6755.56</td>
  1105. </tr>
  1106. <tr>
  1107. <td>合计</td>
  1108. <td>6435656756.45</td>
  1109. <td>3478787.78</td>
  1110. <td>9789789.78</td>
  1111. <td>456456456.4</td>
  1112. <td>2345.45645</td>
  1113. <td>2345645.645</td>
  1114. </tr>
  1115. </tbody>
  1116. </table>
  1117. </div>
  1118. <hr>
  1119. <!--**************************************-->
  1120. <h3>例五:上3行下1行4列固定 $("#tab_Test5").FrozenTable(3,1,4);</h3>
  1121. <div style="OVERFLOW: auto;width:830px;height:228px;">
  1122. <table id='tab_Test5' border="1" width='1000'>
  1123. <tbody align="right">
  1124. <tr class='tabTh'>
  1125. <td rowspan="3" width="100">险种大类</td>
  1126. <td colspan='3'>201401</td>
  1127. <td colspan='3'>201402</td>
  1128. <td colspan='3'>201403</td>
  1129. </tr>
  1130. <tr class='tabTh'>
  1131. <td colspan='3'>保费收入-再保前</td>
  1132. <td colspan='3'>保费收入-再保前</td>
  1133. <td colspan='3'>保费收入-再保前</td>
  1134. </tr>
  1135. <tr class='tabTh'>
  1136. <td width="100">业务</td>
  1137. <td width="100">财务</td>
  1138. <td width="100">差异</td>
  1139. <td width="100">业务</td>
  1140. <td width="100">财务</td>
  1141. <td width="100">差异</td>
  1142. <td width="100">业务</td>
  1143. <td width="100">财务</td>
  1144. <td width="100">差异</td>
  1145. </tr>
  1146. <tr><td>106T-保证保险</td><td>1,550,703.52</td><td>1,550,703.52</td><td>0</td><td>33,253.36</td><td>33,751.68</td><td>-498.32</td><td>359,825.44</td><td>359,327.12</td><td><a href="javascript:funDetail(201403,11,'106T-保证保险');">498.32</a></td></tr><tr><td>107T-车险(交强险)</td><td>108,968,962.13</td><td>108,975,420.57</td><td>-6,458.44</td><td>59,672,975.8</td><td>59,672,975.8</td><td>0</td><td>93,049,926.62</td><td>93,048,446.62</td><td><a href="javascript:funDetail(201403,11,'107T-车险(交强险)');">1,480</a></td></tr><tr><td>108T-车险(商业险)</td><td>260,085,392.36</td><td>260,086,515.73</td><td>-1,123.37</td><td>131,815,686.81</td><td>131,819,291.79</td><td>-3,604.98</td><td>211,276,060.23</td><td>211,279,616.87</td><td><a href="javascript:funDetail(201403,11,'108T-车险(商业险)');">-3,556.64</a></td></tr><tr><td>109T-房屋险</td><td>1,107,386.23</td><td>1,119,230.85</td><td>-11,844.62</td><td>369,424.34</td><td>355,734.12</td><td>13,690.22</td><td>960,523.51</td><td>968,921.8</td><td><a href="javascript:funDetail(201403,11,'109T-房屋险');">-8,398.29</a></td></tr><tr><td>110T-工程险</td><td>52,470,322.9</td><td>52,507,149.28</td><td>-36,826.38</td><td>14,755,632.67</td><td>14,755,852.67</td><td>-220</td><td>15,896,332.08</td><td>16,042,977.52</td><td><a href="javascript:funDetail(201403,11,'110T-工程险');">-146,645.44</a></td></tr><tr><td>111T-航空险</td><td>35,000</td><td>35,000</td><td>0</td><td>24,000</td><td>24,000</td><td>0</td><td>624,139.65</td><td>624,139.65</td><td><a href="javascript:funDetail(201403,11,'111T-航空险');">0</a></td></tr><tr><td>112T-核能保险</td><td>-32,310.31</td><td>-32,310.31</td><td>0</td><td>-3,595.88</td><td>-3,595.88</td><td>-0</td><td>0</td><td>613,688.52</td><td><a href="javascript:funDetail(201403,11,'112T-核能保险');">-613,688.52</a></td></tr><tr><td>113T-货运险</td><td>43,497,043.86</td><td>30,272,003.63</td><td>13,225,040.23</td><td>30,613,997.26</td><td>43,864,961.78</td><td>-13,250,964.52</td><td>35,183,537.22</td><td>35,178,483.83</td><td><a href="javascript:funDetail(201403,11,'113T-货运险');">5,053.39</a></td></tr><tr><td>114T-机损险</td><td>29,099,318</td><td>29,140,225.36</td><td>-40,907.36</td><td>5,191,951.05</td><td>5,251,451.05</td><td>-59,500</td><td>4,391,957.53</td><td>4,410,737.16</td><td><a href="javascript:funDetail(201403,11,'114T-机损险');">-18,779.63</a></td></tr><tr><td>115T-家财_网络运输</td><td>46,837,972.77</td><td>46,837,972.77</td><td>0</td><td>29,376,846.16</td><td>28,095,149.71</td><td>1,281,696.45</td><td>52,867,517.14</td><td>52,867,517.14</td><td><a href="javascript:funDetail(201403,11,'115T-家财_网络运输');">0</a></td></tr><tr><td>116T-健康险</td><td>3,717,646.85</td><td>3,717,627.85</td><td>19</td><td>879,773.63</td><td>879,773.63</td><td>0</td><td>7,472,994.73</td><td>7,382,280.93</td><td><a href="javascript:funDetail(201403,11,'116T-健康险');">90,713.8</a></td></tr><tr><td>118T-农业保险</td><td>1,414,563.84</td><td>1,414,563.84</td><td>0</td><td>-</td><td>-</td><td>-</td><td>0</td><td>0</td><td><a href="javascript:funDetail(201403,11,'118T-农业保险');">0</a></td></tr><tr><td>119T-其他险</td><td>100,909.35</td><td>102,486.35</td><td>-1,577</td><td>107,333.2</td><td>107,327.26</td><td>5.94</td><td>58,285.9</td><td>53,785.9</td><td><a href="javascript:funDetail(201403,11,'119T-其他险');">4,500</a></td></tr><tr><td>120T-企财险</td><td>59,998,291.68</td><td>60,366,903.16</td><td>-368,611.48</td><td>54,224,227.21</td><td>54,277,584.45</td><td>-53,357.24</td><td>35,521,913</td><td>35,698,351.18</td><td><a href="javascript:funDetail(201403,11,'120T-企财险');">-176,438.18</a></td></tr><tr><td>121T-石油保险</td><td>0</td><td>0</td><td>0</td><td>10,162,810.36</td><td>10,162,810.34</td><td>0.02</td><td>1,273,794.7</td><td>1,350,044.13</td><td><a href="javascript:funDetail(201403,11,'121T-石油保险');">-76,249.43</a></td></tr><tr><td>122T-责任险D&O</td><td>3,625,020.13</td><td>3,819,020.14</td><td>-194,000.01</td><td>5,468,840.52</td><td>5,469,479.46</td><td>-638.94</td><td>4,218,825.8</td><td>4,219,266.33</td><td><a href="javascript:funDetail(201403,11,'122T-责任险D&O');">-440.53</a></td></tr><tr><td>123T-责任险EPL</td><td>19,881,666.11</td><td>19,882,001.02</td><td>-334.91</td><td>2,282,775.4</td><td>2,284,408.11</td><td>-1,632.71</td><td>6,306,791.86</td><td>6,318,862.07</td><td><a href="javascript:funDetail(201403,11,'123T-责任险EPL');">-12,070.21</a></td></tr><tr><td>124T-责任险</td><td>59,985,249.04</td><td>60,530,443.77</td><td>-545,194.73</td><td>13,735,315.84</td><td>13,877,263.33</td><td>-141,947.49</td><td>43,509,201.62</td><td>43,883,090.48</td><td><a href="javascript:funDetail(201403,11,'124T-责任险');">-373,888.86</a></td></tr><tr><td>125T-船舶险</td><td>4,923,672.2</td><td>4,926,172.2</td><td>-2,500</td><td>1,926,401.3</td><td>1,926,398.47</td><td>2.83</td><td>6,749,028.93</td><td>6,684,434.63</td><td><a href="javascript:funDetail(201403,11,'125T-船舶险');">64,594.3</a></td></tr><tr><td>126T-意外险</td><td>51,587,871.39</td><td>51,549,092.3</td><td>38,779.09</td><td>13,265,440.72</td><td>13,246,548.4</td><td>18,892.32</td><td>28,865,132.9</td><td>28,968,105.07</td><td><a href="javascript:funDetail(201403,11,'126T-意外险');">-102,972.17</a></td></tr><tr><td>127T-家财险</td><td>5,104,985.4</td><td>5,105,175.4</td><td>-190</td><td>2,599,149.11</td><td>2,599,149.11</td><td>0</td><td>4,438,643.37</td><td>4,188,623.37</td><td><a href="javascript:funDetail(201403,11,'127T-家财险');">250,020</a></td></tr>
  1147. <tr class='tabTh'>
  1148. <td>合计</td> <td>753,959,667.45</td><td>741,905,397.43</td><td>12,054,270.02</td><td>376,502,238.86</td><td>388,700,315.28</td><td>-12,198,076.42</td><td>553,024,432.25</td><td>554,140,700.32</td><td>6,268.07</td>
  1149. </tr>
  1150. </tbody>
  1151. </table>
  1152. </div>
  1153. <hr>
  1154. <!--**************************************-->
  1155. <h3>例六:上2行下1行2列固定 $("#tab_Test6").FrozenTable(2,1,2);</h3>
  1156. <div style="OVERFLOW: auto;width:1000px;height:222px;">
  1157. <table id='tab_Test6' border="1" width='1200px'>
  1158. <tbody>
  1159. <tr class='tabth'>
  1160. <td rowspan='2' width='100px'>事故季度</td>
  1161. <td rowspan='2' width='100px'>业务线</td>
  1162. <td width='100px'>IBNR</td>
  1163. <td colspan='2'>已赚保费(再保后)</td>
  1164. <td colspan='3'>分摊参考数</td>
  1165. <td colspan='2'>IBNR分摊</td>
  1166. </tr>
  1167. <tr class='tabth'>
  1168. <td>(1)</td>
  1169. <td width='100px'>机构A<br>(2)</td>
  1170. <td width='100px'>机构B<br>(3)</td>
  1171. <td width='150px'>(4)=(2)* 55%1</td>
  1172. <td width='150px'>(5)=(3)* 30%2</td>
  1173. <td width='100px'>合计<br>(6)</td>
  1174. <td width='150px'>机构A<br>(7)=(4)/(6)*(1)</td>
  1175. <td width='150px'>机构B<br>(8)=(5)/(6)*(1)</td>
  1176. </tr>
  1177. <tr>
  1178. <td>0.0</td>
  1179. <td>0.0</td>
  1180. <td>0.0</td>
  1181. <td>0.0</td>
  1182. <td>0.0</td>
  1183. <td>0.0</td>
  1184. <td>0.0</td>
  1185. <td>0.0</td>
  1186. <td>0.0</td>
  1187. <td>0.0</td>
  1188. </tr>
  1189. <tr>
  1190. <td>0.0</td>
  1191. <td>0.0</td>
  1192. <td>0.0</td>
  1193. <td>0.0</td>
  1194. <td>0.0</td>
  1195. <td>0.0</td>
  1196. <td>0.0</td>
  1197. <td>0.0</td>
  1198. <td>0.0</td>
  1199. <td>0.0</td>
  1200. </tr>
  1201. <tr>
  1202. <td>0.0</td>
  1203. <td>0.0</td>
  1204. <td>0.0</td>
  1205. <td>0.0</td>
  1206. <td>0.0</td>
  1207. <td>0.0</td>
  1208. <td>0.0</td>
  1209. <td>0.0</td>
  1210. <td>0.0</td>
  1211. <td>0.0</td>
  1212. </tr>
  1213. <tr>
  1214. <td>0.0</td>
  1215. <td>0.0</td>
  1216. <td>0.0</td>
  1217. <td>0.0</td>
  1218. <td>0.0</td>
  1219. <td>0.0</td>
  1220. <td>0.0</td>
  1221. <td>0.0</td>
  1222. <td>0.0</td>
  1223. <td>0.0</td>
  1224. </tr>
  1225. <tr>
  1226. <td>0.0</td>
  1227. <td>0.0</td>
  1228. <td>0.0</td>
  1229. <td>0.0</td>
  1230. <td>0.0</td>
  1231. <td>0.0</td>
  1232. <td>0.0</td>
  1233. <td>0.0</td>
  1234. <td>0.0</td>
  1235. <td>0.0</td>
  1236. </tr>
  1237. <tr>
  1238. <td>0.0</td>
  1239. <td>0.0</td>
  1240. <td>0.0</td>
  1241. <td>0.0</td>
  1242. <td>0.0</td>
  1243. <td>0.0</td>
  1244. <td>0.0</td>
  1245. <td>0.0</td>
  1246. <td>0.0</td>
  1247. <td>0.0</td>
  1248. </tr>
  1249. <tr>
  1250. <td>0.0</td>
  1251. <td>0.0</td>
  1252. <td>0.0</td>
  1253. <td>0.0</td>
  1254. <td>0.0</td>
  1255. <td>0.0</td>
  1256. <td>0.0</td>
  1257. <td>0.0</td>
  1258. <td>0.0</td>
  1259. <td>0.0</td>
  1260. </tr>
  1261. <tr>
  1262. <td>0.0</td>
  1263. <td>0.0</td>
  1264. <td>0.0</td>
  1265. <td>0.0</td>
  1266. <td>0.0</td>
  1267. <td>0.0</td>
  1268. <td>0.0</td>
  1269. <td>0.0</td>
  1270. <td>0.0</td>
  1271. <td>0.0</td>
  1272. </tr>
  1273. <tr>
  1274. <td>0.0</td>
  1275. <td>0.0</td>
  1276. <td>0.0</td>
  1277. <td>0.0</td>
  1278. <td>0.0</td>
  1279. <td>0.0</td>
  1280. <td>0.0</td>
  1281. <td>0.0</td>
  1282. <td>0.0</td>
  1283. <td>0.0</td>
  1284. </tr>
  1285. <tr>
  1286. <td>0.0</td>
  1287. <td>0.0</td>
  1288. <td>0.0</td>
  1289. <td>0.0</td>
  1290. <td>0.0</td>
  1291. <td>0.0</td>
  1292. <td>0.0</td>
  1293. <td>0.0</td>
  1294. <td>0.0</td>
  1295. <td>0.0</td>
  1296. </tr>
  1297. <tr>
  1298. <td>0.0</td>
  1299. <td>0.0</td>
  1300. <td>0.0</td>
  1301. <td>0.0</td>
  1302. <td>0.0</td>
  1303. <td>0.0</td>
  1304. <td>0.0</td>
  1305. <td>0.0</td>
  1306. <td>0.0</td>
  1307. <td>0.0</td>
  1308. </tr>
  1309. <tr>
  1310. <td>0.0</td>
  1311. <td>0.0</td>
  1312. <td>0.0</td>
  1313. <td>0.0</td>
  1314. <td>0.0</td>
  1315. <td>0.0</td>
  1316. <td>0.0</td>
  1317. <td>0.0</td>
  1318. <td>0.0</td>
  1319. <td>0.0</td>
  1320. </tr>
  1321. <tr>
  1322. <td>0.0</td>
  1323. <td>0.0</td>
  1324. <td>0.0</td>
  1325. <td>0.0</td>
  1326. <td>0.0</td>
  1327. <td>0.0</td>
  1328. <td>0.0</td>
  1329. <td>0.0</td>
  1330. <td>0.0</td>
  1331. <td>0.0</td>
  1332. </tr>
  1333. <tr>
  1334. <td>0.0</td>
  1335. <td>0.0</td>
  1336. <td>0.0</td>
  1337. <td>0.0</td>
  1338. <td>0.0</td>
  1339. <td>0.0</td>
  1340. <td>0.0</td>
  1341. <td>0.0</td>
  1342. <td>0.0</td>
  1343. <td>0.0</td>
  1344. </tr>
  1345. <tr>
  1346. <td>0.0</td>
  1347. <td>0.0</td>
  1348. <td>0.0</td>
  1349. <td>0.0</td>
  1350. <td>0.0</td>
  1351. <td>0.0</td>
  1352. <td>0.0</td>
  1353. <td>0.0</td>
  1354. <td>0.0</td>
  1355. <td>0.0</td>
  1356. </tr>
  1357. <tr>
  1358. <td>0.0</td>
  1359. <td>0.0</td>
  1360. <td>0.0</td>
  1361. <td>0.0</td>
  1362. <td>0.0</td>
  1363. <td>0.0</td>
  1364. <td>0.0</td>
  1365. <td>0.0</td>
  1366. <td>0.0</td>
  1367. <td>0.0</td>
  1368. </tr>
  1369. <tr class='tabth'>
  1370. <td colspan='2'>合计</td>
  1371. <td>0.0</td>
  1372. <td>0.0</td>
  1373. <td>0.0</td>
  1374. <td>0.0</td>
  1375. <td>0.0</td>
  1376. <td>0.0</td>
  1377. <td>0.0</td>
  1378. <td>0.0</td>
  1379. </tr>
  1380. </tbody>
  1381. </table>
  1382. </div>
  1383. <hr>
  1384. <!--**************************************-->
  1385. <h3>例七:固定列合并 $("#tab_Test7").FrozenTable(2,1,1);</h3>
  1386. <div style="OVERFLOW: auto;width:500px;height:222px;">
  1387. <table id='tab_Test7' border="1" width='600'>
  1388. <tr class='tabth'>
  1389. <td rowspan='2' width="150px">中支</td>
  1390. <td width="150px">上季度末IBNR/Case</td>
  1391. <td width="150px">截至当月再保后Case</td>
  1392. <td width="150px">IBNR</td>
  1393. </tr>
  1394. <tr class='tabth'>
  1395. <td>(1)</td>
  1396. <td>(2)</td>
  1397. <td>(3)=(1)*(2)</td>
  1398. </tr>
  1399. <tr>
  1400. <td rowspan='2'>0.0</td>
  1401. <td>0.0</td>
  1402. <td>0.0</td>
  1403. <td>0.0</td>
  1404. </tr>
  1405. <tr>
  1406. <td>0.0</td>
  1407. <td>0.0</td>
  1408. <td>0.0</td>
  1409. </tr>
  1410. <tr>
  1411. <td rowspan='2'>0.0</td>
  1412. <td>0.0</td>
  1413. <td>0.0</td>
  1414. <td>0.0</td>
  1415. </tr>
  1416. <tr>
  1417. <td>0.0</td>
  1418. <td>0.0</td>
  1419. <td>0.0</td>
  1420. </tr>
  1421. <tr>
  1422. <td rowspan='2'>0.0</td>
  1423. <td>0.0</td>
  1424. <td>0.0</td>
  1425. <td>0.0</td>
  1426. </tr>
  1427. <tr>
  1428. <td>0.0</td>
  1429. <td>0.0</td>
  1430. <td>0.0</td>
  1431. </tr>
  1432. <tr>
  1433. <td rowspan='2'>0.0</td>
  1434. <td>0.0</td>
  1435. <td>0.0</td>
  1436. <td>0.0</td>
  1437. </tr>
  1438. <tr>
  1439. <td>0.0</td>
  1440. <td>0.0</td>
  1441. <td>0.0</td>
  1442. </tr>
  1443. <tr>
  1444. <td rowspan='2'>0.0</td>
  1445. <td>0.0</td>
  1446. <td>0.0</td>
  1447. <td>0.0</td>
  1448. </tr>
  1449. <tr>
  1450. <td>0.0</td>
  1451. <td>0.0</td>
  1452. <td>0.0</td>
  1453. </tr>
  1454. <tr>
  1455. <td rowspan='2'>0.0</td>
  1456. <td>0.0</td>
  1457. <td>0.0</td>
  1458. <td>0.0</td>
  1459. </tr>
  1460. <tr>
  1461. <td>0.0</td>
  1462. <td>0.0</td>
  1463. <td>0.0</td>
  1464. </tr>
  1465. <tr>
  1466. <td rowspan='2'>0.0</td>
  1467. <td>0.0</td>
  1468. <td>0.0</td>
  1469. <td>0.0</td>
  1470. </tr>
  1471. <tr>
  1472. <td>0.0</td>
  1473. <td>0.0</td>
  1474. <td>0.0</td>
  1475. </tr>
  1476. <tr>
  1477. <td rowspan='2'>0.0</td>
  1478. <td>0.0</td>
  1479. <td>0.0</td>
  1480. <td>0.0</td>
  1481. </tr>
  1482. <tr>
  1483. <td>0.0</td>
  1484. <td>0.0</td>
  1485. <td>0.0</td>
  1486. </tr>
  1487. </table>
  1488. </div>
  1489. <hr>
  1490. </body>
  1491. </html>

上面3中的index.html为原文中的案列,可以教你如何设置传的参数,冻结的行和列。当然在上面的示例中是没有问题的,但是我在使用时出现了错乱的问题,这跟你整个页面的布局是有关系的,后来通过控制台发现主要是两个值的问题,left和top属性值,具体位置也不一定,要看你具体是设置的哪几行和哪几列进行冻结,需根据具体情况结合浏览器调试,进行调整TableFreeze.js中的相应的div以及table的left和top属性,由于我在使用时,是在创建完表格后使用的冻结方法,另外一个会产生的问题是当页面的大小会发生变化时,表格再次出现混乱的情况,因为使用的是绝对定位,所以在页面大小改变的事件里需要将原来创建的表格去除掉并重新创建,为了更好的体验还需要将div的滚动条的位置置为初始位置,代码如下:

 

 

  1. $(window).resize(function () {
  2. $("#oTableLH_mainTable").remove();
  3. $("#oDivH_mainTable").remove();
  4. $("#oDivL_mainTable").remove();
  5. $("#mainTable").FrozenTable(3, 0, 2);
  6. $("#divTable").scrollTop(0);
  7. $("#divTable").scrollLeft(0);
  8. });

在这里简单记录下remove()这个方法,即使当页面中不存在这个元素时,也不会出错,所以放心大胆的使用就行了,remove掉的元素可以使用浏览器控制台中找到,还会出现表格混乱的问题是,创建的表格可能是透明的,会看到底部的表格的内容,这时可以将表格的样式加上前景色,置为白色就可以了,这一篇就记录这写内容吧。如果大家在使用过程中有什么问题,可以留言。再次声明,如若有人发现了此文中用到的插件的出处,请提供原文链接,谢谢!这里提供一片类似的博客内容,地址:http://www.cnblogs.com/hanyun/archive/2012/04/23/2466274.html


转载于:https://www.cnblogs.com/Allen0910/p/7051120.html

本文内容由网友自发贡献,转载请注明出处:https://www.wpsshop.cn/w/知新_RL/article/detail/315702
推荐阅读
  

闽ICP备14008679号