当前页面: 开发资料首页 → Javascript 专题 → 网页制作奇思妙想 表格也加滚动条
网页制作奇思妙想 表格也加滚动条
摘要: 网页制作奇思妙想 表格也加滚动条
<tr>
<td>
其实这个东西没什么技术含量,就是给大家提供一个给表格加滚动条的思路。
下面是源代码:
<textarea class=fm id=code rows=12 cols=78>
<head>
My table
<script>
function init(){
theT=createTable("我的收藏夹",["Group:150","Name:300","URL:200","Visited:100","Modify:100","Delete:100"]);
//参数说明:createTable(strCaption,colHeads)
//strCaption 标题
//colHeads 是一个array,每个item的格式是 名称:宽度 的字符串
for(var i=0;i<40;i++){
theR=theT.insertRow();
for(var j=0;j<7;j++){
theC=theR.insertCell();
theC.innerText=j;
}
}
}
function createTable(strCaption,colHeads){
//参数说明:colHeads 是一个array,每个item的格式是 名称:宽度 的字符串
//生成表格
oTable=document.createElement("table");
document.body.insertBefore(oTable);
//设置class
oTable.className="table0";
with(oTable.style){
tableLayout="fixed";
borderCollapse="collapse"
borderSpacing="0px";
}
//设置变量
oTCaption=oTable.createCaption();
oTHead=oTable.createTHead();
oTFoot=oTable.createTFoot();
//生成标题
oTCaption.innerText=strCaption;
//设置列宽
oTHead.insertRow();
for(var i=0;i
</textarea>
<input style="CURSOR: hand" onfocus=this.blur() onclick="runEx('code')" type=button value=运行代码> <input style="WIDTH: 95px; CURSOR: hand" onfocus=this.blur() onclick=cycode(code) type=button value=复制到剪贴板 name=Submit> <input style="CURSOR: hand" onfocus=this.blur() onclick=svcode(code) type=button value=另存代码> [Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行]
</td>
</tr>
</table>
↑返回目录
前一篇: 强制弹出广告页面+自动最小化代码
后一篇: Lightbox—新颖实用的显示图片效果