|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
DIV本身就是容器性质的,你不但可以内嵌table还可以内嵌文本和其它的HTML代码CSS是CascadingstyleSheets的简称,中文译作“层叠样式表单”。
实在这个器材没甚么手艺含量,就是给人人供应一个给表格加转动条的思绪。
上面是源代码:
<html><head><title>Mytable</title><style>.table0{height:90%;}.table0caption{width:100%;height:26px;line-height:26px;font-size:20px;font-color:black;font-weight:900;letter-spacing:5px;}.table0theadtd{text-align:center;vertical-align:middle;height:20px;line-height:18px;font-size:14px;font-color:black;font-weight:bold;padding-top:2px;padding-bottom:2px;border:#5551pxsolid;margin:0px;}.table0tfoottd{text-align:left;vertical-align:middle;height:20px;line-height:18px;font-size:12px;font-color:black;font-weight:bold;padding-top:2px;padding-bottom:2px;padding-left:12px;padding-right:12px;border:#5551pxsolid;}.table0tbodytd{width:100%;height:auto;border:#5551pxsolid;padding:0px;margin:0px;}.table1tbodytd{text-align:left;vertical-align:middle;height:20px;line-height:18px;font-size:14px;font-color:#444;font-weight:normal;padding-top:2px;padding-bottom:2px;padding-left:12px;padding-right:12px;border-right:#5551pxsolid;border-bottom:#5551pxsolid;overflow:hidden;text-overflow:ellipsis;word-break:keep-all;word-wrap:normal;}</style><script>functioninit(){theT=createTable("我的保藏夹",["Group:150","Name:300","URL:200","Visited:100","Modify:100","Delete:100"]);//参数申明:createTable(strCaption,colHeads)//strCaption题目//colHeads是一个array,每一个item的格局是称号:宽度的字符串for(vari=0;i<40;i++){theR=theT.insertRow();for(varj=0;j<7;j++){theC=theR.insertCell();theC.innerText=j;}}}functioncreateTable(strCaption,colHeads){//参数申明:colHeads是一个array,每一个item的格局是称号:宽度的字符串//天生表格oTable=document.createElement("table");document.body.insertBefore(oTable);//设置classoTable.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(vari=0;i<colHeads.length;i++){tHeadName=colHeads.split(":")[0];tHeadWidth=isNaN(parseInt(colHeads.split(":")[1]))?"auto":parseInt(colHeads.split(":")[1]);theCell=oTHead.rows[0].insertCell();theCell.style.width=tHeadWidth;}theCell=oTHead.rows[0].insertCell();theCell.width=20;oTHead.rows[0].style.display="none";//天生表头oTHead.insertRow();for(vari=0;i<colHeads.length;i++){tHeadName=colHeads.split(":")[0];tHeadWidth=isNaN(parseInt(colHeads.split(":")[1]))?"auto":parseInt(colHeads.split(":")[1]);theCell=oTHead.rows[1].insertCell();theCell.innerText=tHeadName;theCell.style.width=tHeadWidth;}theCell=oTHead.rows[1].insertCell();theCell.width=24;//天生表脚oTFoot.insertRow();theCell=oTFoot.rows[0].insertCell();theCell.innerHTML="<marqueescrollDelay=50scrollAmount=2>Copyrights2005.Hutiapresents.</marquee>";theCell=oTFoot.rows[0].insertCell();theCell.colSpan=colHeads.length-1;theCell=oTFoot.rows[0].insertCell();theCell.width=20;//天生主体oTable.all.tags("Tbody")[0].insertRow();theCell=oTable.all.tags("Tbody")[0].rows[0].insertCell();theCell.colSpan=colHeads.length+1;oMain=document.createElement("DIV");theCell.insertBefore(oMain);with(oMain.style){width="100%";height="100%";overflowY="auto";overflowX="hidden";margin="0px";marginLeft="-1px";}oTBody=document.createElement("table");oMain.insertBefore(oTBody);oTable.oTBody=oTBody;//克制选择oTCaption.onselectstart=oTHead.onselectstart=oTFoot.onselectstart=function(){return(false);}//设置classoTBody.className="table1";with(oTBody.style){width=oTable.offsetWidth-15;tableLayout="fixed";borderCollapse="collapse"borderSpacing="0px";padding="0px";margin="0px";}//初始化列宽oTBody.insertRow();for(vari=0;i<colHeads.length;i++){tHeadWidth=isNaN(parseInt(colHeads.split(":")[1]))?"auto":parseInt(colHeads.split(":")[1]);theCell=oTBody.rows[0].insertCell();theCell.style.width=tHeadWidth;}oTBody.rows[0].style.display="none";return(oTBody);}functioninsertRow(){varintL=oTBody.rows.length;theRow=oTBody.insertRow();theRow.index=intL;theRow.onmou搜索引擎优化ver=rowOnMouseOver;theRow.onmou搜索引擎优化ut=rowOnMouseOut;theRow.onclick=rowOnClick;for(vari=0;i<colHeads.length;i++){theCell=theRow.insertCell();theCell.tabIndex=0;theCell.hideFocus=true;theCell.colIndex=i;theCell.onmou搜索引擎优化ver=function(){this.focus();};theCell.onmou搜索引擎优化ut=cellOnBlur;theCell.onfocus=cellOnFo
12下一页
你可以轻松地控制页面的布局。 |
|