首页 > 编程 > HTML > 正文

Web上功能强大的DbGrid表格HTC组件[只需在Table中指定样式就可以完

2024-08-26 00:15:53
字体:
来源:转载
供稿:网友

Grid.htm
代码如下:
<style>
INPUT
{
DefineINPUTOnClick:expression(this.onclick=function(){if(this.type=="button"){this.style.color=chooseColor();}});
}
</style>
<script>
var iGridRowCount=0;
var iGridColCount=0;
function createGrid()
{
DivID.innerHTML="";
if(iGridRowCount==0){iGridRowCount=5;}
if(iGridColCount==0){iGridColCount=5;}
var vTable=document.createElement("table");
vTable.style.behavior="url(Grid.htc)";
if(defineGridBgColorID.style.color)
{vTable.defineGridBgColor=defineGridBgColorID.style.color;}
if(defineFirstRowBgColorID.style.color)
{vTable.defineFirstRowBgColor=defineFirstRowBgColorID.style.color;}
if(defineFirstColBgColorID.style.color)
{vTable.defineFirstColBgColor=defineFirstColBgColorID.style.color;}
if(defineCurRowBgColorID.style.color)
{vTable.defineCurRowBgColor=defineCurRowBgColorID.style.color;}
if(defineCurColBgColorID.style.color)
{vTable.defineCurColBgColor=defineCurColBgColorID.style.color;}
if(defineCurEditBgColorID.style.color)
{vTable.defineCurEditBgColor=defineCurEditBgColorID.style.color;}
for(mIndex=0;mIndex<iGridRowCount;mIndex++)
{
var vTr=vTable.insertRow(mIndex);
for(nIndex=0;nIndex<iGridColCount;nIndex++)
{
vTd=vTr.insertCell(nIndex);
vTd.innerText="行"+mIndex+"列"+nIndex;
}
}
DivID.appendChild(vTable);
}
function chooseColor()
{
var strColor=DlgHelper.ChooseColorDlg();
strColor=strColor.toString(16);
if(strColor.length<6)
{
var sTempString="000000".substring(0,6-strColor.length);
strColor=sTempString.concat(strColor);
}
return strColor;
}
</script>
<div id="DivID"></div>
<object id="DlgHelper" classid="clsid:3050f819-98b5-11cf-bb82-00aa00bdce0b" width="0px" height="0px"></object>
<fieldset>
<button onclick="window.confirm('已实现功能')">Grid参数区</button><br>
<input type=button value="表格背景" id="defineGridBgColorID"><br>
<input type=button value="头行背景" id="defineFirstRowBgColorID"><br>
<input type=button value="头列背景" id="defineFirstColBgColorID"><br>
<input type=button value="当前选择行背景" id="defineCurRowBgColorID"><br>
<input type=button value="当前选择列背景" id="defineCurColBgColorID"><br>
<input type=button value="当前选择编辑单元格背景" id="defineCurEditBgColorID"><br>
<button onclick="window.confirm('未实现功能')">保留功能区</button><br>
<input type=text value="" id="defineGridRowCount"><button onclick="iGridRowCount=defineGridRowCount.value;">行数</button><br>
<input type=text value="" id="defineGridColCount"><button onclick="iGridColCount=defineGridColCount.value;">列数</button><br>
<input type=radio>是<input type=radio>否启动行调整<br>

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表