window.onload=function(){
//创建表
var ttable = document.createElement("table");
ttable.setAttribute("border-collapse","1");
ttable.setAttribute("width","500");
ttable.setAttribute("cellpadding","3");
ttable.setAttribute("cellscpaing","0");
//创建tbody
var ttbody = document.createElement("tbody");
ttable.appendChild(ttbody);
//插入第一行
ttbody.insertRow(0);
ttable.rows[0].insertCell(0);
ttbody.rows[0].cells[0].appendChild(document.createTextNode("1,1"));
ttbody.rows[0].insertCell(1);
ttbody.rows[0].cells[1].appendChild(document.createTextNode("1,2"));
//插入第二行
ttbody.insertRow(1);
ttable.rows[1].insertCell(0);
ttbody.rows[1].cells[0].appendChild(document.creteTextNode("2,1"));
ttable.rows[1].insertCell(1);
ttbody.rows[1].cells[1].appendChild(document.createTextNode("2,2"));
document.body.appendChild(ttable);
}
//创建表
var ttable = document.createElement("table");
ttable.setAttribute("border-collapse","1");
ttable.setAttribute("width","500");
ttable.setAttribute("cellpadding","3");
ttable.setAttribute("cellscpaing","0");
//创建tbody
var ttbody = document.createElement("tbody");
ttable.appendChild(ttbody);
//插入第一行
ttbody.insertRow(0);
ttable.rows[0].insertCell(0);
ttbody.rows[0].cells[0].appendChild(document.createTextNode("1,1"));
ttbody.rows[0].insertCell(1);
ttbody.rows[0].cells[1].appendChild(document.createTextNode("1,2"));
//插入第二行
ttbody.insertRow(1);
ttable.rows[1].insertCell(0);
ttbody.rows[1].cells[0].appendChild(document.creteTextNode("2,1"));
ttable.rows[1].insertCell(1);
ttbody.rows[1].cells[1].appendChild(document.createTextNode("2,2"));
document.body.appendChild(ttable);
}
解决方案 »
- flexigrid json 格式
- 这样功能怎么实现?
- extjs chart的时间轴折线图不能正确显的问题
- 我如何知道在剪贴板中的数据是不是图像格式?
- easyui中,treegrid的url问题
- 网站本机有用,一放到空间就没用了呢??(高手请进)
- 页面表单对象是按什么标志编组的呢?应该是name,但是我改变name却无法解除掉表单对象的编组。该如何解除呢?急等
- 如何使多选select框的内容为选中状态
- 谁能给一个输入日期校验的例子和把数字转换成货币显示的例子!
- js相对路径转绝对路径
- html怎么弹出以哥对话框用于选择文件夹路径得?
- JavaScript中FileSystemObject对象是否可以操作图片文件
//创建表
var ttable = document.createElement("table");
ttable.setAttribute("border-collapse","1");
ttable.setAttribute("width","500");
ttable.setAttribute("cellpadding","3");
ttable.setAttribute("cellscpaing","0");
//创建tbody
var ttbody = document.createElement("tbody");
ttable.appendChild(ttbody);
//插入第一行
ttbody.insertRow(0);
ttable.rows[0].insertCell(0);
ttbody.rows[0].cells[0].appendChild(document.createTextNode("1,1"));
ttbody.rows[0].insertCell(1);
ttbody.rows[0].cells[1].appendChild(document.createTextNode("1,2"));
//插入第二行
ttbody.insertRow(1);
ttable.rows[1].insertCell(0);
ttbody.rows[1].cells[0].appendChild(document.createTextNode("2,1"));
ttable.rows[1].insertCell(1);
ttbody.rows[1].cells[1].appendChild(document.createTextNode("2,2"));
document.body.appendChild(ttable);
}