JavaScript *** 作用友华表cell插件,该怎么处理

JavaScript *** 作用友华表cell插件,该怎么处理,第1张

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="index.aspx.cs" Inherits="index" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<title>Cell(华表)</title>

<meta http-equiv="Content-Type" content="text/htmlcharset=gb2312" />

<script type="text/javascript" language="javascript">

function cellReg() {

//华表注册

document.getElementById("cellweb1").Login("", "", "注册ID", "注册码")

}

</script>

<script language="javascript" type="text/javascript">

function onload() {

var cell = document.getElementById("cellweb1")

cell.ShowSideLabel(0, cell.GetCurSheet())//隐藏横向坐标

cell.ShowTopLabel(0, cell.GetCurSheet())//隐藏纵向坐标

}

</script>

<script language="javascript" type="text/javascript">

function getValue()

{

var date = new Date()

var startdate = date.getFullYear()+"-"+date.getMonth()+"-"+date.getDate()+" "+date.getHours()+":"+date.getMinutes()+":"+date.getSeconds()

var enddate = date.getFullYear()+"-"+date.getMonth()+"-"+date.getDate()+" "+date.getHours()+":"+date.getMinutes()+":"+date.getSeconds()

var printdate = date.getFullYear()+"-"+date.getMonth()+"-"+date.getDate()+" "+date.getHours()+":"+date.getMinutes()+":"+date.getSeconds()

var err = document.all.cellweb1.openfile("<%=ConfigurationSettings.AppSettings["cell"].ToString()%>newCell.cll","")

if(err == -1)

{

alert("模板文件不存在请确认!")

}

var cell = document.getElementById("cellweb1")

for (var j = 0j <= 9j++)

{

cell.SetCellTextColor(1 + j, 3, cell.GetCurSheet(),1)

}

cell.SetCellInput(1, -1, cell.GetCurSheet(),5)//设置id列为只读

//填充模板头

cell.S(1,2,cell.GetCurSheet(),"开始时间:")

cell.S(2,2,cell.GetCurSheet(),startdate)

cell.S(3,2,cell.GetCurSheet(),"结束时间:")

cell.S(4,2,cell.GetCurSheet(),enddate)

cell.S(5,2,cell.GetCurSheet(),"打印时间:")

cell.S(7,2,cell.GetCurSheet(),printdate)

//填充模板头

//填充表头背景颜色

for(var h = 0h <= 9h++)

{

cell.SetCellBackColor(1+h,3,cell.GetCurSheet(), 5)

}

//填充表列名

cell.S(1,3,cell.GetCurSheet(),"序号")

cell.S(2,3,cell.GetCurSheet(),"编号")

cell.S(3,3,cell.GetCurSheet(),"传感器")

cell.S(4,3,cell.GetCurSheet(),"单位")

cell.S(5,3,cell.GetCurSheet(),"地点")

cell.S(6,3,cell.GetCurSheet(),"状态")

cell.S(7,3,cell.GetCurSheet(),"数值")

cell.S(8,3,cell.GetCurSheet(),"时间")

cell.S(9,3,cell.GetCurSheet(),"开始时间")

cell.S(10,3,cell.GetCurSheet(),"结束时间")

//填充表列名

var xh = document.getElementById("myxuhao").value //id

var nodeid = document.getElementById("mynodeid").value //nodeid

var sensor = document.getElementById("mysensor").value //传感器名

var unit = document.getElementById("myunit").value //单位

var placement= document.getElementById("myplacement").value//地点

var status= document.getElementById("mystatus").value //状态

var value= document.getElementById("myvalue").value//值

var save_time= document.getElementById("mysave_time").value//保存时间

var startTime= document.getElementById("mystartTime").value//开始时间

var endTime= document.getElementById("myendTime").value//结束时间

var str = new Array()

var str1 = new Array()

var str2 = new Array()

var str3 = new Array()

var str4 = new Array()

var str5 = new Array()

var str6 = new Array()

var str7 = new Array()

var str8 = new Array()

var str9 = new Array()

str = xh.split(",")

str1 = nodeid.split(",")

str2 = sensor.split(",")

str3 = unit.split(",")

str4 = placement.split(",")

str5 = status.split(",")

str6 = value.split(",")

str7 = save_time.split(",")

str8 = startTime.split(",")

str9 = endTime.split(",")

for(var i=0i<str.length++i)

{

cell.S(1,4+i,cell.GetCurSheet(), str[i])

cell.S(2,4+i,cell.GetCurSheet(), str1[i])

cell.S(3,4+i,cell.GetCurSheet(), str2[i])

cell.S(4,4+i,cell.GetCurSheet(), str3[i])

cell.S(5,4+i,cell.GetCurSheet(), str4[i])

cell.S(6,4+i,cell.GetCurSheet(), str5[i])

cell.S(7,4+i,cell.GetCurSheet(), str6[i])

cell.S(8,4+i,cell.GetCurSheet(), str7[i])

cell.S(9,4+i,cell.GetCurSheet(), str8[i])

cell.S(10,4+i,cell.GetCurSheet(), str9[i])

}

cell.ReDraw()//重新加载报表数据

}

</script>

<script type="text/javascript" language="javascript">

function btn_Edit()

{

//设置表页为只读

document.getElementById("cellweb1").WorkbookReadonly = false

//设置不支持允许拖动

document.getElementById("cellweb1").AllowDragdrop = false

}

//打印预览

function btn_PrePrint()

{

document.getElementById("cellweb1").PrintPreview(true, document.getElementById("cellweb1").GetCurSheet)

}

//打印

function btn_Print()

{

document.getElementById("cellweb1").PrintSheet(false, document.getElementById("cellweb1").GetCurSheet)

}

//保存

function btn_Save()

{

document.getElementById("cellweb1").SaveFile()

}

function btn_SetPrint()

{

document.getElementById("cellweb1").PrintPageSetup()

}

function fn_Print()

{

if (confirm("确定列印吗"))

{

document.all.btnWonem_tabButtonCtl.style.display = "none"

window.print()

return false

}

else

{

return false

}

}

</script>

<style type="text/css">

.style1

{

height: 526px

}

#btnquery

{

width: 66px

}

#btnedit

{

width: 68px

}

#btnprint

{

width: 73px

}

#btnsave

{

width: 75px

}

</style>

</head>

<!--onload="cellreg()"-->

<body onload="onload()">

<form id="form1" runat="server">

<table width="100%">

<tr>

<td height="50px">

<input id="btnquery" type="button" value="查询" onclick="return getValue()" />

<input id="btnedit" type="button" value="编辑" onclick="return btn_Edit()" />

<input id="btnpreprint" type="button" value="打印预览" onclick="return btn_PrePrint()" />

<input id="btnsetprint" type="button" value="打印设置" onclick="return btn_SetPrint()" />

<input id="btnprint" type="button" value="打印" onclick="return btn_Print()" />

<input id="btnsave" type="button" value="保存" onclick="return btn_Save()" />

<input type="hidden" name="myxuhao" id="myxuhao" value='<%=xuhao %>' />

<input type="hidden" name="mynodeid" id="mynodeid" value='<%=nodeid %>' />

<input type="hidden" name="mysensor" id="mysensor" value='<%=sensor %>' />

<input type="hidden" name="myunit" id="myunit" value='<%=unit %>' />

<input type="hidden" name="myplacement" id="myplacement" value='<%=placement %>' />

<input type="hidden" name="mystatus" id="mystatus" value='<%=status %>' />

<input type="hidden" name="myvalue" id="myvalue" value='<%=value %>' />

<input type="hidden" name="mysave_time" id="mysave_time" value='<%=save_time %>' />

<input type="hidden" name="mystartTime" id="mystartTime" value='<%=startTime %>' />

<input type="hidden" name="myendTime" id="myendTime" value='<%=endTime %>' />

</td>

</tr>

<tr>

<td class="style1">

<object id="cellweb1" style="z-index: 102left: 14pxwidth: 95%position: absolutetop: 70pxheight: 100%"

classid="clsid:3f166327-8030-4881-8bd2-ea25350e574a">

<param name="_version" value="65536" />

<param name="_extentx" value="14182" />

<param name="_extenty" value="7197" />

<param name="_stockprops" value="0" />

</object>

</td>

</tr>

</table>

</form>

</body>

</html>

table单元格本来就可读可写啊,比如table的id是 'tblA',你要读他第3行第4列内容,就是

var txt = document.getElementById('tblA').rows[2].cells[3].innerHTML

这个txt就是你要的内容

要写它的这个格子的内容,就是

document.getElementById('tblA').rows[2].cells[3].innerHTML = "你要设置的内容"

rows 和 cells 索引是从0开始

要加一列,就是

var row = document.createElement("tr")

var cell = document.createElement("td")

row.appendChild(cell)

//... 有几列create几个,都append进去

document.getElementById('tblA').appendChild(row)

要删第三行,

var row = document.getElementById('tblA').rows[2] ;

row.parentNode.removeChild(row)

input 加个id就可以了,如:

<td><input type="text" id="t1"></td>

然后js里用:

document.getElementById("t1").value 来取得input的值


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/tougao/11180513.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-14
下一篇 2023-05-14

发表评论

登录后才能评论

评论列表(0条)

保存