就是说,自动添加一列,就是添加<td>列名</td>
解决方案 »
- jpql查询传值到jsp页面发生异常,在线等大家帮助
- java axis tomcat??
- 在项目中加了log4j,tomcat重现线程异常。
- source attachment does not contain the souce for the file jdbcOdbcDriver.class
- htm页面如何能定时关闭呢??同时关闭的时候还不会有退出的提示窗口呢??
- 求救:HTTP Status 500 出错 请求高手指点 静太页面可以浏览
- 高分请教:java如何取得本地Outlook通讯录?
- 有好的“开源网上商店”程序介绍吗?
- struts2 指定class就会报错
- 怎么样连接数据库2000Server+j2sdk-1_4_0_01-windows-i586+jswdk-1.0.1
- 请问在JSP 里面怎样表示记录类型????
- 如何实现大量的如入,修改,和删除?
//在table中增加tr行
//tableIdName:table表的ID号名称,类型为字符串
//trClassName:tr行的样式类名称,类型为字符串
//arrHtml:tr行的td中的内容,类型为字符串数组
function addDetails(tableIdName,trClassName,arrHtml)
{
var tb=document.all(tableIdName);
if(tb && tb.tagName=="TABLE")
{
var rowId=tb.rows.length;
var row=tb.insertRow(rowId);
var cols=arrHtml.length;
if(row)
{
row.className=trClassName ;
for(var j=0;j<cols;j++)
{
var cell=row.insertCell(j);
if(cell)
{
cell.innerHTML=arrHtml[j];
}
}
}
}
} //增加子项函数
function addList() {
var tableIdName="listtab";
var trClassName="boxtitle" ;
var arrHtml = new Array();
arrHtml[0]="<input type=\"checkbox\" name=\"ids\">";
arrHtml[1]="<input type=\"text\" name=\"Re\" >";
arrHtml[2]="<input readonly type=\"text\" name=\"Subjectname\">";
arrHtml[3]="<input type=\"text\" name=\"Amount\">";
addDetails(tableIdName,trClassName,arrHtml);
}</script>
<BODY BGCOLOR="#FFFFFF">
<input type="button" value="add" onclick="addList();">
<table id = listtab>
<tr><td><td><td><td>
</table>
</BODY>
给个例子你:要分,还是想要分^_^<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>甘特图</title>
<style>
th{color:#FFF;background-color:#F89807;}
td{color:#000;background-color:#FDEDCC;height:16}
input,textarea,th,td{font-size:9pt}
</style>
</head> <script language=javascript>
//时间坐标--Y(年)、M(月)、W(周)、D(日)
function gante(){
//定义公用属性
this.Data;
this.Head=['编号','任务名称','负责人','开始时间','结束时间'];
this.toShow=[0,1,2,3,4]; this.getShow=drawingGante; //定义方法
function drawingGante(){
var outxt=""
outxt+="<table border=1 width=100% cellspacing=1 cellpadding=0 bordercolor=#000000>"
outxt+="<tr><th align=center><font color=#FFFFFF>随心所欲--不逾矩</font></th></tr><tr><th><table border=0 width=100% cellspacing=1 cellpadding=0>" //输出表头
outxt+="<tr>";
for(var obj in this.Head){
for(var isShow in this.toShow){
if(obj==this.toShow[isShow])
outxt+="<td nowrap>"+this.Head[obj]+"</td>"
}
}
//输出数据内容
for(var rs in this.Data){
outxt+="<tr>"
for(var fd in this.Data[rs]){
for(var isShow in this.toShow){
if(fd==this.toShow[isShow])
outxt+="<td nowrap>"+this.Data[rs][fd]+"</td>"
}
}
}
outxt+="</table></th></tr></table>"
return outxt;
}}
var gt=new gante();
gt.Data=[['1','发动机设计','dlt','2002-1-1','2002-6-1'],['2','PDM','dd','2002-6-4','2002-11-1'],['3','专用件设计','zhan','2002-2-1','2002-3-1'],['4','PDM','dd','2002-6-4','2002-11-1']];</script>
<BODY>
<input type=button value=show1 onclick="gt.toShow=[0];show.innerHTML=gt.getShow()">
<input type=button value=show2 onclick="gt.toShow=[0,1];show.innerHTML=gt.getShow()">
<input type=button value=showall onclick="gt.toShow=[0,1,2,3,4];show.innerHTML=gt.getShow()">
<div id=show></div>
</BODY>
</HTML>