<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    <!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">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>無標(biāo)題文檔-SH!</title>
    <style>
    /* 左右分割條樣式 */
    .lrSeparator {
    background-color:#549FE3;
    cursor:e-resize;
    font-size : 1px;
    }
    /* 上下分割條樣式 */
    .udSeparator {
    background-color:#549FE3;
    cursor:s-resize;
    font-size : 1px;
    }
    td {
    border:1px solid #549FE3;
    }
    </style>
    <script>
    /**
    * 類 名 稱: Separator|SP
    * 功能說明: 分割條類
    * 版權(quán)信息: CopyRight 2005-2006 JoeCom
    * 參數(shù)說明: o1,o2 : 兩個(gè)對象
    spTpe: 方向,是左右,還是上下
    w:寬度;wx:left的差值;wy:top的差值
    wh:左右拖動時(shí),是寬度的差值,上下則是高度的差值
    wl:上下拉動時(shí)時(shí)的一個(gè)差值
    差值的存在是因?yàn)榭丶赡艽嬖赽order,padding,top等一些情況,
    還有就是控件的position不是為absolute
    * 創(chuàng) 建 人: JoeCom | MSN:juwuyi@hotmail.com | blog:http://hi.baidu.com/joecom
    * 創(chuàng)建日期: 2006-07-27
    * 修改記錄:
    * 備 注 : IE下效果最好,F(xiàn)F下TD標(biāo)簽不支持onresize事件?
    */

    //以下定義拖拉方向的常量
    SP_LEFTRIGHT = 1; //左右拖拉
    SP_UPDOWN = 2; //上下拖拉

    function Separator(o1,o2,spType,w,wx,wy,wh,wl){
    var me = this;
    this.o1 = (typeof o1=="string")?document.getElementById(o1):o1;
    this.o2 = (typeof o2=="string")?document.getElementById(o2):o2;
    this.w = w||3; //Width or Height
    this.wx = wx||0; //parentOffsetLeft
    this.wy = wy||0; //parentOffsetTop
    this.wh = wh||0; //parentOffsetHeight
    this.wl = wl||0; //parentOffsetWidth
    //this.wr = wr||0; //parentOffsetRight
    this.autoresize = true;
    this.spType = (spType==SP_UPDOWN)?SP_UPDOWN:SP_LEFTRIGHT;
    this.allWidth = this.o1.clientWidth + this.o2.clientWidth + this.w ;
    this.allHeight = this.o1.clientHeight + this.o2.clientHeight + this.w ;
    this.isIE = false;

    this.addEvent = function(el, evname, func) {
    if (el.attachEvent) { // IE
    el.attachEvent("on" + evname, func);
    this.isIE = true;
    } else if (el.addEventListener) { // Gecko / W3C
    el.addEventListener(evname, func, true);
    } else {
    el["on" + evname] = func;
    }
    };

    this.sp = document.createElement("div");
    document.body.appendChild(this.sp);

    this.init = function(){
    if (this.spType==SP_LEFTRIGHT)
    {
    with (this.sp){
    style.position = "absolute";
    style.left = this.o1.offsetLeft + this.o1.clientWidth + this.wx + "px";
    style.top = this.o1.offsetTop + this.wy + "px" ;
    style.width = this.w;
    style.height = this.o1.clientHeight + this.wh + "px";
    className = "lrSeparator";
    style.zIndex = "200";
    }
    }else
    {
    with (this.sp){
    style.position = "absolute";
    style.left = this.o1.offsetLeft + this.wx + "px";
    style.top = this.o1.offsetTop + this.o1.clientHeight + this.wy + "px" ;
    style.width = this.o1.clientWidth + this.wh + "px";
    style.height = this.w;
    className = "udSeparator";
    style.zIndex = "200";
    }
    }
    }

    this.init();
    this.dd = new ObjectDragDrop(this.sp);
    this.dd.moveStyle = (this.spType==SP_LEFTRIGHT)?DD_HMOVE:DD_VMOVE;

    this.resize = function(){
    this.init();
    }

    this.addEvent(window,"resize",function(){me.resize();});
    this.addEvent(this.o1,"resize",function(){me.resize();});

    this.dd.isMoved = function(newPosX,newPosY){
    if (me.spType==SP_LEFTRIGHT)
    {
    var mw1 = me.o1.getAttribute("minWidth");
    var mw2 = me.o2.getAttribute("minWidth");
    if (mw1==null){mw1 = 0;}
    if (mw2==null){mw2 = 0;}
    return {x:((newPosX - me.o1.offsetLeft)>=mw1&&(newPosX - me.o1.offsetLeft)<=(me.allWidth - mw2)),y:false};
    }else
    {
    var mh1 = me.o1.getAttribute("minHeight");
    var mh2 = me.o2.getAttribute("minHeight");
    if (mh1==null){mh1 = 0;}
    if (mh2==null){mh2 = 0;}
    return {x:false,y:((newPosY - me.o1.offsetTop - me.wy)>=mh1&&(newPosY - me.o1.offsetTop - me.wy)<=( me.allHeight - mh2))};
    }
    }

    this.dd.onDrop = function(){
    if (me.spType==SP_LEFTRIGHT)
    {
    me.o1.style.width = me.sp.offsetLeft - me.o1.offsetLeft - me.wx - me.wl;
    if (!me.autoresize){
    me.o2.style.width = me.allWidth - me.o1.clientWidth - me.w;
    if (me.o2.tagName!="TD")
    {
    me.o2.style.left = me.sp.offsetLeft;
    }
    }
    }else
    {
    me.o1.style.height = me.sp.offsetTop - me.o1.offsetTop - me.wy;
    if (!me.autoresize){
    me.o2.style.height = me.allHeight - me.o1.clientHeight ;
    if (me.o2.tagName!="TR")
    {
    me.o2.style.top = me.sp.offsetTop;
    }
    }
    }
    if (!me.isIE){
    me.init();
    }
    }
    }

    /**
    * 類 名 稱: DragDrop|DD
    * 功能說明: 可拖動類
    * 版權(quán)信息: CopyRight 2005-2006 JoeCom
    * 創(chuàng) 建 人: JoeCom | MSN:juwuyi@hotmail.com | blog:http://hi.baidu.com/joecom
    * 創(chuàng)建日期: 2006-07-19
    * 修改記錄: 1. 2006-07-21 加上scrollTop 和 scrollLeft的相對移動
    ?. 2006-07-25 加入moveStyle屬性,增加水平移動和垂直移動的功能
    ?. 2006-07-25 加入isMoved函數(shù),增加范圍移動功能
    */

    //以下定義移動方向的常量
    DD_FREEMOVE = 0; //自由移動,沒有限制
    DD_HMOVE = 1; //水平移動,也就是左右移動
    DD_VMOVE = 2; //垂直移動,也就是上下移動

    function ObjectDragDrop(obj){
    var me = this;
    this.moveStyle = DD_FREEMOVE ;
    this.foo = (typeof obj=="string")?document.getElementById(obj):obj;
    this.onDrop = function(){};
    this.onDrag = function(){};
    this.isMoved = function(newPosX,newPosY){return {x:true,y:true}};//offsetX:x的移動距離;offsetY:y的移動距離

    this.foo.onmousedown = function(e){
    var foo = me.foo;
    e = e||event;
    if( e.layerX ){ foo.oOffset = {x:e.layerX, y:e.layerY }; }
    else { foo.oOffset = {x:e.offsetX, y:e.offsetY }; }
    document.onmousemove = me.drag;
    document.onmouseup = me.drop;
    document.onselectstart = function(){ return false; };
    }

    this.drag = function(e){
    var foo = me.foo;
    e=e||event;
    var mv = me.isMoved(e.clientX - foo.oOffset.x + document.body.scrollLeft,
    e.clientY - foo.oOffset.y + document.body.scrollTop);
    if (mv.x&&me.moveStyle!=DD_VMOVE)
    {
    foo.style.left = e.clientX - foo.oOffset.x + document.body.scrollLeft + "px";
    }
    if (mv.y&&me.moveStyle!=DD_HMOVE)
    {
    foo.style.top = e.clientY - foo.oOffset.y + document.body.scrollTop + "px";
    }
    me.onDrag();
    }

    this.drop = function(e){
    e=e||event;
    document.onmousemove = document.onmouseup = document.onselectstart = null;
    me.onDrop();
    }
    }


    </script>
    <script>
    window.onload=function(){
     
    //div左右拉動
    var divsp = new Separator(divl,divr,SP_LEFTRIGHT,2);
    divsp.autoresize = false;

    }
    </script>
    </head>

    <body>
    <div id=divl minWidth="30" style="position:absolute;top:350px;width:100px;left:0px;height:100px;background-color:#CCCCCC">div1</div>
    <div id=divr minWidth="30" style="position:absolute;top:350px;width:100px;left:102px;height:100px;background-color:#FF0000">div2</div>

    </body>
    </html>

    posted on 2010-02-26 10:04 sanmao 閱讀(859) 評論(0)  編輯  收藏

    只有注冊用戶登錄后才能發(fā)表評論。


    網(wǎng)站導(dǎo)航:
     

    常用鏈接

    留言簿(5)

    隨筆分類

    隨筆檔案

    搜索

    •  

    最新評論

    閱讀排行榜

    評論排行榜

    主站蜘蛛池模板: 亚洲人成网77777色在线播放| 男女交性无遮挡免费视频| 亚洲色欲www综合网| 国产成人+综合亚洲+天堂| 97人妻无码一区二区精品免费| 免费无码又爽又刺激高潮| 亚洲欧洲国产精品久久| 亚洲精品伦理熟女国产一区二区 | 国产亚洲男人的天堂在线观看 | 人与禽交免费网站视频| 全部免费国产潢色一级 | 久久精品蜜芽亚洲国产AV| 国产男女爽爽爽免费视频| 免费国产小视频在线观看| 国产V亚洲V天堂无码| ssswww日本免费网站片| 免费一级e一片在线播放| 亚洲av无码一区二区三区人妖| aa毛片免费全部播放完整 | 国产黄色片在线免费观看| 亚洲一卡二卡三卡| 国产国产人免费视频成69堂| 久久亚洲AV成人无码国产| 一区二区在线免费观看| 亚洲伊人久久大香线蕉苏妲己| 在线观看免费亚洲| 国产又大又黑又粗免费视频| jizzjizz亚洲日本少妇| 国产乱人免费视频| 51午夜精品免费视频| 精品亚洲一区二区| 久久国产免费一区| 亚洲国产韩国一区二区| 日本黄网站动漫视频免费| 亚洲三级高清免费| 日本视频免费在线| 一级毛片大全免费播放| 亚洲一区二区三区AV无码| 久久成人免费大片| 亚洲小说区图片区另类春色| 国偷自产一区二区免费视频|