实现可动态改变宽度的表格简单方法__教程 |
|
日期:2007-5-20 1:26:51 人气:60 [大 中 小] |
|
|
|
} else { document.getElementById("a1").style.cursor='w-resize'; document.getElementById("a3").style.cursor='w-resize'; } document.getElementById("a5").style.cursor='w-resize';
function mOut() { mYes="0" }
function mUp() { mYes="0" }
function mDown(curColumn) { var className0; mYes="1"; className0=document.getElementById("table1").rows[0].cells[parseInt(curColumn)-1].className; leftID0=className0.substring(cNameRoot.length,className0.length); className0=document.getElementById("table1").rows[0].cells[parseInt(curColumn)+1].className; rightID0=className0.substring(cNameRoot.length,className0.length); mLeft=event.clientX; }
function mMove(curColumn) { if(mYes=="1") { var leftID; var rightID; var curLeft; curLeft=event.clientX; leftID=parseInt(parseInt(leftID0) + (parseInt(curLeft) - parseInt(mLeft)) * misAdjust); rightID=parseInt(parseInt(rightID0) - (parseInt(curLeft) - parseInt(mLeft)) * misAdjust); if(parseInt(leftID)>1 && parseInt(rightID)>1) { for(var i=0;i{ document.getElementById("table1").rows[i].cells[parseInt(curColumn)-1].className=cNameRoot + (leftID); document.getElementById("table1").rows[i].cells[parseInt(curColumn)+1].className=cNameRoot + (rightID); } } } }
function tmOut() { //tmYes="0" }
function tmUp() { tmYes="0" window.status="*"; }
var ColumnCount=(document.getElementById("table1").rows[0].cells.length)/2; var ID0=new Array(ColumnCount); var ID1=new Array(ColumnCount); var ID2=new Array(ColumnCount); var idSum;
function tmDown() { var className0; tmYes="1"; idSum=0; for(var i=0;i{ className0=document.getElementById("table1").rows[0].cells[i*2].className; ID0[i]=className0.substring(cNameRoot.length,className0.length); ID2[i]=0; idSum+=parseInt(ID0[i]); } for(var i=0;i{ ID1[i]=ID0[i]/idSum; } mLeft=event.clientX; }
function tmMove() { if(tmYes=="1") { var curLeft; curLeft=event.clientX; for(var i=0;i{ ID2[i]=parseInt(ID0[i]) + parseInt((parseInt(curLeft) - parseInt(mLeft)) * ID1[i]) } //window.status = mLeft + ";" + curLeft + "||||" + ID1[0] + ";" + ID1[1] + ";" + ID1[2] + " |||| " + ID0[0] + ";" + ID0[1] + ";" + ID0[2] + " |||| " + ID2[0] + ";" + ID2[1] + ";" + ID2[2] + ";"; for(var i=0;i{ for(var j=0;j{ document.getElementById("table1").rows[i].cells[j*2].className=cNameRoot + (ID2[j]); } } } }
< /script> |
|
出处:本站原创 作者:佚名 |
|
|