`
aideehorn
  • 浏览: 256486 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

iframe模拟frame拖动(兼容ie&ff)

阅读更多

http://lily64.blogbus.com/logs/13966200.html




<table width=955 border=0>           
<TR>
                <TD align=middle background=http://www.zzjianghu.com/image/index27.gif
                  height=500><IFRAME id=left name=left
                  src="http://www.zzjianghu.com/bwbb-zys-index-01.htm" frameBorder=0 width=540
                  scrolling=yes height=500></IFRAME></TD>

<td id=myborder width=100% style="background:yellow"></td>

                <TD align=middle background=http://www.zzjianghu.com/image/index31.gif
                  height=500><IFRAME id=right name=right
                  src="http://www.zzjianghu.com/bwbb-gqf-index-01.htm" frameBorder=0 width=320
                  scrolling=yes height=500></IFRAME></TD>
</TR>
</table>

<script>
    var moveobject = "myborder";

    bx=0;
    ifmove=false;
    function mymovestart(e)
    {
    document.getElementById(moveobject).style.cursor="move";
    ifmove=true;
    if(!e)e=event;
    bx=e.clientX;
    }
    function mymovestop()
    {
    document.getElementById(moveobject).style.cursor="default";
    ifmove=false;
    }
    function mymove(e)
    {
    if(ifmove)
    {
    if(!e)e=event;
    off=parseInt(document.getElementById("left").width)+(e.clientX-bx);
    if(off>0)
    document.getElementById("left").width=off;
    off=parseInt(document.getElementById("right").width)-(e.clientX-bx);
    if(off>0)
    document.getElementById("right").width=off;
    bx=e.clientX;
    }
    }
    function myover()
    {
    document.getElementById(moveobject).style.cursor="move";
    }
    function myout()
    {
    mymovestop();
    }
    document.getElementById(moveobject).onmousedown=mymovestart;
    document.getElementById(moveobject).onmouseup=mymovestop;
    document.getElementById(moveobject).onmousemove=mymove;
    document.getElementById(moveobject).onmouseover=myover;
    document.getElementById(moveobject).onmouseout=myout;
    document.getElementById(moveobject).ondrag=function(){return false;}
</script>

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics