日韩久久久精品,亚洲精品久久久久久久久久久,亚洲欧美一区二区三区国产精品 ,一区二区福利

JavaScript 拖動改變面板大小

系統(tǒng) 2974 0
TAB.JPG

上面是實際效果,雖然丑陋。不過當時寫這個效果的時候也并不順利。

代碼如下:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style>
#tab
{
?table-layout:auto;
?border-collapse:collapse;
?border:1px solid #000000;
?width:100%;
}
div
{
?width:100%;
?margin:0px;
?padding:0px;
?overflow:auto;
?border: 1px solid #4CA2ED;
?background-color:#E8F2FE;
?font-size:9pt;
}
td
{
?position:relative;
?padding:0px;
?margin:0px;
}
</style>
<script type="text/javascript">
function $(dom_id)
{
?return document.getElementById(dom_id);
}
function MouseDownToResize(obj)
{?
?obj.mouseDownY = event.clientY;
?$('td1').pareneTdH = $('td1').offsetHeight;
?$('td2').pareneTdH = $('td2').offsetHeight;
?$('td3').pareneTdH = $('td3').offsetHeight;
?$('tab').pareneTableH = $('tab').offsetHeight;
?obj.setCapture();//事件擴張
}
function MouseMoveToResize(obj)
{?
?if(!obj.mouseDownY) return false;
?var newHeight = $('td2').pareneTdH*1+event.clientY*1-obj.mouseDownY;
?//拖動
?if((newHeight<0 && -1*newHeight<$('td1').pareneTdH )||(newHeight>0 && newHeight<$('td3').pareneTdH))
?{
??? $('td1').style.height = $('td1').pareneTdH+newHeight;
??? $('td3').style.height = $('td3').pareneTdH-newHeight;
?$('div1').style.height = $('td1').pareneTdH+newHeight;
??? $('div3').style.height = $('td3').pareneTdH-newHeight;
?$('tab').style.height = $('tab').pareneTableH;
?window.status = newHeight +"||"+ $('td3').style.height;
?}
}
function MouseUpToResize(obj)
{
??? obj.releaseCapture();
??? obj.mouseDownY=0;
}
</script>
</head>
<body>
? <table id="tab" cellpadding="0" cellspacing="0">
??? <tr><td valign=top id="td1"><div id="div1" style="height:250px;">
<pre>?
function $(dom_id)
{
?return document.getElementById(dom_id);
}
function MouseDownToResize(obj)
{?
?obj.mouseDownY = event.clientY;
?$('td1').pareneTdH = $('td1').offsetHeight;
?$('td2').pareneTdH = $('td2').offsetHeight;
?$('td3').pareneTdH = $('td3').offsetHeight;
?$('tab').pareneTableH = $('tab').offsetHeight;
?obj.setCapture();//事件擴張
}
function MouseMoveToResize(obj)
{?
?if(!obj.mouseDownY) return false;
?var newHeight = $('td2').pareneTdH*1+event.clientY*1-obj.mouseDownY;
?//拖動
?if((newHeight<0 && -1*newHeight<=$('td1').pareneTdH )||(newHeight>0 && newHeight<=$('td3').pareneTdH))
?{
??? $('td1').style.height = $('td1').pareneTdH+newHeight;
??? $('td3').style.height = $('td3').pareneTdH-newHeight;
?$('div1').style.height = $('td1').pareneTdH+newHeight;
??? $('div3').style.height = $('td3').pareneTdH-newHeight;
?$('tab').style.height = $('tab').pareneTableH;
?window.status = newHeight +"||"+ $('td3').style.height;
?}
}
function MouseUpToResize(obj)
{
??? obj.releaseCapture();
??? obj.mouseDownY=0;
}
</pre>
?</div></td></tr>
?<tr bgcolor="#000" height="2" onmousedown="MouseDownToResize(this);" onmousemove="MouseMoveToResize(this);" onmouseup="MouseUpToResize(this);" style="cursor:n-resize;"><td id="td2"></td></tr>
?<tr><td id="td3"><div id="div3" style="height:150px;"></div></td></tr>
? </table>
</body>
</html>

JavaScript 拖動改變面板大小


更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯(lián)系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦!!!

發(fā)表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 军事| 林芝县| 建昌县| 普洱| 方城县| 长顺县| 吴忠市| 江城| 永德县| 正定县| 武城县| 平江县| 方正县| 武定县| 漳州市| 清水河县| 平阳县| 青龙| 平阴县| 财经| 嘉兴市| 平乐县| 威宁| 万全县| 通化市| 体育| 五指山市| 胶南市| 阳春市| 吴川市| 县级市| 竹北市| 精河县| 阿勒泰市| 沙雅县| 长寿区| 日照市| 莱阳市| 新闻| 合江县| 长兴县|