Simple way to implement a table with dynamic width change

Source: Internet
Author: User
Dynamic <%
' Generate a CSS class to set up a table
Cssclassname= "T"
cssclassnamemaxid=400
Cssclassnameminid=1
Minwidth=50
Response.Write "<style>"
Response.Write vbCrLf
For I=cssclassnameminid to Cssclassnamemaxid
Response.Write "." & Cssclassname & I
Response.Write "{cursor:default;font-size:13;color:ff0000;width:" & (MinWidth + i) & "}"
Response.Write vbCrLf
Next
Response.Write "</style>"
% >
<body onmouseup= "mUp (); Tmup ();" >
<table border= "0" cellpadding= "0" id= "table1" bgcolor=f0f0f0 cellspacing= "0" >
&LT;TR bgcolor=dddddd height=23>
&LT;TD style= ' border-bottom:1 solid #707070 ' background= ' o_h.gif ' class= ' <%=cssclassname & '% ' > ' > Bodyguard & Lt;/td>
&LT;TD style= ' border-bottom:1 solid #707070 ' width=5 id= ' A1 ' align= ' Center ' onmousedown= ' Mdown (' 1 ') "onmousemove=" Mmove (' 1 '); "onmouseup=" MUp () "onmouseout=" Mout (); "></td>
&LT;TD style= ' border-bottom:1 solid #707070 ' background= ' o_h.gif "Align=center class=" <%=cssclassname & "100"% & gt; " > Chef </td>
&LT;TD style= ' border-bottom:1 solid #707070 ' width=5 id= ' A3 ' onmousedown= ' Mdown (' 3 ') ' onmousemove= ' Mmove (' 3 '); Onmouseup= "MUp ()" onmouseout= "Mout ();" ></td>
&LT;TD style= ' border-bottom:1 solid #707070 ' background= ' o_h.gif "Align=center class=" <%=cssclassname & "100"% & gt; " > Driver </td>
&LT;TD style= ' border-bottom:1 solid #707070 ' width=5 id= ' A5 "onmousedown=" Tmdown () "Onmousemove=" Tmmove (); "onmouseup= "Tmup ()" onmouseout= "tmout ();" ></td>
</tr>
<%
Rcount=1
For I=1 to 10
Rcount=rcount+1
% >
<tr height=23>
&LT;TD style= ' border-bottom:1 solid #e0e0e0 ' class= ' <%=cssclassname & '% > ' >
Monkey king
</td>
&LT;TD style= ' border-bottom:1 solid #e0e0e0 ' > </td>
&LT;TD style= ' border-bottom:1 solid #e0e0e0 ' class= ' <%=cssclassname & '% > ' align=center >
Pig
</td>
&LT;TD style= ' border-bottom:1 solid #e0e0e0 ' > </td>
&LT;TD style= ' border-bottom:1 solid #e0e0e0 ' class= ' <%=cssclassname & '% > ' align=center >
Sand Monk
</td>
&LT;TD style= ' border-bottom:1 solid #e0e0e0 ' > </td>
</tr>
<%next% >
</table>
</body>
< script language=javascript>


var minwidth= "<%=minWdith%>";
var cnameroot= "<%=cssClassName%>";
var rowcount= "<%=rcount%>";

var myes= "0";
var mleft;
var leftID0;
var rightID0;
var misadjust=1.2//For adjustment error

var tmyes= "0";


Define mouse pointer style when dragging
var IE6;
IE6 = (window.navigator.appVersion.indexOf ("MSIE 6.")!=0)
if (IE6)
{
document.getElementById ("A1"). style.cursor= ' Col-resize ';
document.getElementById ("A3"). Style.cursor= ' Col-resize ';
}
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



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.