Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title></title>
<script type="text/javascript">
function ShowRow(id,min,ud){
var o=ShowRow['zxc'+id],obj=document.getElementById(id),table=obj.getElementsByTagName('TABLE')[0],ud=typeof(ud)=='number'&&ud<0?-1:1,rows;
if (obj&&table&&!o){
rows=table.rows,min=typeof(min)=='number'&&min>0?min:0;
o=ShowRow['zxc'+id]={
rows:rows,
lgth:rows.length-1,
min:min,
cnt:min
}
row=o.rows[o.cnt];
obj.style.height=row.offsetTop+row.offsetHeight+'px';
}
if (o){
o.cnt=Math.max(Math.min(o.cnt+ud,o.lgth),o.min);
obj.style.height=o.rows[o.cnt].offsetTop+o.rows[o.cnt].offsetHeight+'px';
}
}
</script></head>
<body onload="ShowRow('tst',2,-1);">
<input type="button" name="" value="Show +1" onmouseup="ShowRow('tst',2,1);" />
<input type="button" name="" value="Show -1" onmouseup="ShowRow('tst',2,-1);" />
<div id="tst" style="width:200px;overflow:hidden;height:80px;border:solid red 1px;" >
<table width="200" border="1">
<tr>
<td>Upload 1</td>
</tr>
<tr>
<td>Upload 2</td>
</tr>
<tr>
<td>Upload 3</td>
</tr>
<tr>
<td>Upload 4</td>
</tr>
<tr>
<td>Upload 5</td>
</tr>
<tr>
<td>Upload 6</td>
</tr>
<tr>
<td>Upload 7</td>
</tr>
<tr>
<td>Upload 8</td>
</tr>
<tr>
<td>Upload 9</td>
</tr>
<tr>
<td>Upload 10</td>
</tr>
</table>
</div>
</body>
</html>
Bookmarks