知识大全 左侧是表头的JS表格控件
Posted 表格
篇首语:积土而为山,积水而为海。本文由小常识网(cha138.com)小编为大家整理,主要介绍了知识大全 左侧是表头的JS表格控件相关的知识,希望对你有一定的参考价值。
左侧是表头的JS表格控件 以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧!
左侧是表头的表格数据展现 支持多行 多表头 固定表头的功能 能够支持标题 获取表格中的数据 支持IE/CHROME 表格能够自适应根据内容行居中 代码如下: <!DOCTYPE PUBLIC " //W C//DTD XHTML Transitional//EN" " < xmlns=" <head runat="server"> <title>Grid左侧固定测试</title> <script src=LeftHeadGrid js></script> <link href="LeftHeadGrid css" rel="stylesheet" type=text/css /> </head> <body> <form id="form " runat="server"> <div id="testdiv" align=center></div> </form> </body> <script type=text/javascript > var test = new LeftHeadGrid( id: "leftHeadGrid" width: title:"danielinbiti" perUnitWidth: rowHeads:[ width:" " rowname:[name:"日期" name:"数值"] ] columnDatas:[ width:[ ] rows:[[ ] [ ]] ] ); test RenderTo("testdiv"); </script> </> LeftHeadGrid js 复制代码 代码如下: var LeftHeadGrid = function(config) this rowHeads = config rowHeads != null ? config rowHeads: [];//name this columnDatas = config columnDatas != null ? config columnDatas: []; this width = config width != null ? config width: ""; this id = config id != null ? config id: "TreGrid"; this perUnitWidth = config perUnitWidth != null ? config perUnitWidth: ; this innerWidth = ; this innerLWidth = ; this height = ; this title = config title != null ? config title: ""; this noDataStr = config noDataStr != null ? config noDataStr: "no data"; LeftHeadGrid prototype createGrid = function() var totalwidth = ; var tableHtml = "<table>"; for(var i= ;i<this rowHeads length;i++) var obj = this rowHeads[i]; var width = obj width; totalwidth = totalwidth + parseInt(width); var rownameobj = obj rowname; for(var j= ;j<rownameobj length;j++) var nameobj = rownameobj[j]; if(j==rownameobj length ) tableHtml = tableHtml + "<tr><td class= bluelast width= " + width + "px >" + nameobj name + "</td></tr>"; else tableHtml = tableHtml + "<tr><td class= bluefirst width= " + width + "px >" + nameobj name + "</td></tr>"; this height = this height + ; tableHtml = tableHtml + "</table>"; var headHtml = "<div class= leftheadcss style= width:" + totalwidth + "px; >"; headHtml = headHtml + tableHtml + "</div>"; this innerLWidth = totalwidth; this innerWidth = this width totalwidth ; return headHtml; LeftHeadGrid prototype RenderTo =function(divId) //var innerWidth = this width ; var headHtml = this createGrid(); var = "<div id= outframe class= outframecss style= width:" + this width + "px; >" + headHtml + "<div id= dataframe class= dataframecss style= width:" + this innerWidth + "px; >" + "<div id= leftgriddataview class= innerdivcss >" + "</div>" + "</div>" + "</div>" = "<div id= divtitle class= grittitle style= width:" + this width + "px;height: px ><big>" + this title + "</big></div>" + + "</div>"; document getElementById(divId) innerHTML = ; this show(); LeftHeadGrid prototype show = function() if(this columnDatas && this columnDatas length> ) var obj = this columnDatas[ ]; var widthArr = obj width; var rows = obj rows; var totalWidth = ; for(var i= ;i<widthArr length;i++) widthArr[i] = parseInt(widthArr[i])*this perUnitWidth; totalWidth = totalWidth + widthArr[i]; var tableHtml = "<table width= "+totalWidth +" >"; for(var i= ;i<rows length;i++) var rowvalueArr = rows[i]; tableHtml = tableHtml + "<tr>"; for(var j= ;j<rowvalueArr length;j++) tableHtml = tableHtml + "<td width= "+widthArr[j]+"px >" + rowvalueArr[j] + "</td>"; tableHtml = tableHtml + "</tr>"; tableHtml = tableHtml + "</table>"; if(this innerWidth>totalWidth) document getElementById("dataframe") style width=(parseInt(totalWidth))+"px"; document getElementById("divtitle") style width=(parseInt(this innerLWidth)+parseInt(totalWidth))+"px"; document getElementById("outframe") style width=(parseInt(this innerLWidth)+parseInt(totalWidth)+ )+"px"; document getElementById("leftgriddataview") innerHTML = tableHtml; else document getElementById("leftgriddataview") style height=(this height+ )+"px"; document getElementById("leftgriddataview") innerHTML = this noDataStr; LeftHeadGrid prototype addData = function(data) this columnDatas = data; this show(); LeftHeadGrid prototype getData = function() var rtnObj = new Array(); if(this columnDatas && this columnDatas length> ) var obj = this columnDatas[ ]; var widthArr = obj width; var rows = obj rows; for(var i= ;i<rows length;i++) var rowvalueArr = rows[i]; for(var j= ;j<rowvalueArr length;j++) if(j== ) rtnObj[i] = rowvalueArr[j]; else rtnObj[i] = rtnObj[i] + " " + rowvalueArr[j]; return rtnObj; LeftHeadGrid prototype getHead = function() var rtnObj = new Array(); for(var i= ;i<this rowHeads length;i++) var obj = this rowHeads[i]; var rownameobj = obj rowname; for(var j= ;j<rownameobj length;j++) var nameobj = rownameobj[j]; if(j== ) rtnObj[i] = nameobj name; else rtnObj[i] = rtnObj[i] + " " + nameobj name; return rtnObj; 如果有需要 各位可以自己更改 完整源码: 代码如下: var LeftHeadGrid = function(config) this rowHeads = config rowHeads != null ? config rowHeads: [];//name this columnDatas = config columnDatas != null ? config columnDatas: []; this width = config width != null ? config width: ""; this id = config id != null ? config id: "TreGrid"; this perUnitWidth = config perUnitWidth != null ? config perUnitWidth: ; this innerWidth = ; this innerLWidth = ; this height = ; this title = config title != null ? config title: ""; this noDataStr = config noDataStr != null ? config noDataStr: "no data"; LeftHeadGrid prototype createGrid = function() var totalwidth = ; var tableHtml = "<table>"; for(var i= ;i<this rowHeads length;i++) var obj = this rowHeads[i]; var width = obj width; totalwidth = totalwidth + parseInt(width); var rownameobj = obj rowname; for(var j= ;j<rownameobj length;j++) var nameobj = rownameobj[j]; if(j==rownameobj length ) tableHtml = tableHtml + "<tr><td class= bluelast width= " + width + "px >" + nameobj name + "</td></tr>"; else tableHtml = tableHtml + "<tr><td class= bluefirst width= " + width + "px >" + nameobj name + "</td></tr>"; this height = this height + ; tableHtml = tableHtml + "</table>"; var headHtml = "<div class= leftheadcss style= width:" + totalwidth + "px; >"; headHtml = headHtml + tableHtml + "</div>"; this innerLWidth = totalwidth; this innerWidth = this width totalwidth ; return headHtml; LeftHeadGrid prototype RenderTo =function(divId) //var innerWidth = this width ; var headHtml = this createGrid(); var = "<div id= outframe class= outframecss style= width:" + this width + "px; >" + headHtml + "<div id= dataframe class= dataframecss style= width:" + this innerWidth + "px; >" + "<div id= leftgriddataview class= innerdivcss >" + "</div>" + "</div>" + "</div>" = "<div id= divtitle class= grittitle style= width:" + this width + "px;height: px ><big>" + this title + "</big></div>" + + "</div>"; document getElementById(divId) innerHTML = ; this show(); LeftHeadGrid prototype show = function() if(this columnDatas && this columnDatas length> ) var obj = this columnDatas[ ]; var widthArr = obj width; var rows = obj rows; var totalWidth = ; for(var i= ;i<widthArr length;i++) widthArr[i] = parseInt(widthArr[i])*this perUnitWidth; totalWidth = totalWidth + widthArr[i]; var tableHtml = "<table width= "+totalWidth +" >"; for(var i= ;i<rows length;i++) var rowvalueArr = rows[i]; tableHtml = tableHtml + "<tr>"; for(var j= ;j<rowvalueArr length;j++) tableHtml = tableHtml + "<td width= "+widthArr[j]+"px >" + rowvalueArr[j] + "</td>"; tableHtml = tableHtml + "</tr>"; tableHtml = tableHtml + "</table>"; if(this innerWidth>totalWidth) document getElementById("dataframe") style width=(parseInt(totalWidth))+"px"; document getElementById("divtitle") style width=(parseInt(this innerLWidth)+parseInt(totalWidth))+"px"; document getElementById("outframe") style width=(parseInt(this innerLWidth)+parseInt(totalWidth)+ )+"px"; document getElementById("leftgriddataview") innerHTML = tableHtml; else document getElementById("leftgriddataview") style height=(this height+ )+"px"; document getElementById("leftgriddataview") innerHTML = this noDataStr; LeftHeadGrid prototype addData = function(data) this columnDatas = data; this show(); LeftHeadGrid prototype getData = function() var rtnObj = new Array(); if(this columnDatas && this columnDatas length> ) var obj = this columnDatas[ ]; var widthArr = obj width; var rows = obj rows; for(var i= ;i<rows length;i++) var rowvalueArr = rows[i]; for(var j= ;j<rowvalueArr length;j++) if(j== ) rtnObj[i] = rowvalueArr[j]; else rtnObj[i] = rtnObj[i] + " " + rowvalueArr[j]; return rtnObj; LeftHeadGrid prototype getHead = function() var rtnObj = new Array(); for(var i= ;i<this rowHeads length;i++) var obj = this rowHeads[i]; var rownameobj = obj rowname; for(var j= ;j<rownameobj length;j++) var nameobj = rownameobj[j]; if(j== ) rtnObj[i] = nameobj name; else rtnObj[i] = rtnObj[i] + " " + nameobj name; return rtnObj; cha138/Article/program/Java/JSP/201311/20355相关参考
常用的左侧导航效果JS简单为提高导航性能而生各位可以参考应用效果展示 HTML: 复制代码代码如下: <!左侧菜单><divclass=menu><ulcl
做web开发大家都遇到过打印的问题对于复杂的表格打印着实令人头痛这片文章介绍一下使用excel打印的解决方法 首先如果客户端调用excel必须降低ie安全级别这样一些非法的控件如什么的都自动安装
js可以利用dom非常轻松的就可以遍历一个表格当然只要是dom中有的所有对象都可以通过js来访问和处理 复制代码代码如下:cha138/Article/program/Java/J
对于创建表格本文提到的算法共有种分别是直接操作dom借助createDocumentFragment借助js的原生表格操作方法 我们先看一下三种算法以及在各种浏览器下的表现第一种直接操作
Word表格插入后想在左侧加一行坚的文字怎么加 以下文字资料是由(本站网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧!Word
知识大全 JS特效代码--仿windows xp左侧菜单效果
JS特效代码--仿windowsxp左侧菜单效果 以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧!
表格控件SpreadStudio7上线 以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧! 通知葡萄城
VS2005系列控件演示之表格 以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧!  
简约JS日历控件代码 以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧!这篇文章介绍了一款简约JS日历控
用JavaScript隐藏控件的方法有两种分别是通过设置控件的style的“display”和“visibility”属性当styledisplay="block"或stylevisibility