javascript

位置:IT落伍者 >> javascript >> 浏览文章

js实现拉伸拖动iframe


发布日期:2021年10月29日
 
js实现拉伸拖动iframe

左边iframe放树目录右边的iframe放index页拖鼠标同时控制个iframe的宽高

期待有人能改进

操作方法鼠标指到个iframe中间可以水平拖纵向拖(控制高度)

缺点CSDN页面放开鼠标后才改大小不占CPU资源 这个是实时改大小所以速度太慢希望有人来改改我是不想弄了反正又没用什么特别的技术

提示拖动的秘密就在filter:alpha(opacity=)这一句


<html>
<script language="javascript">
var mouseX = ;
var mouseY = ;
var w=;
function divonmousemove(){
obj=documentgetElementById("a");
obj=documentgetElementById("b");
obj=documentgetElementById("ab");
if (mouseX!==eventx && mouseY!==eventy)objstylecursor=seresize;
else if (mouseX!==eventx)objstylecursor=eresize;
else if (mouseY!==eventy)objstylecursor=sresize;
else objstylecursor=;
if (eventbutton==){
objstylewidth=parseInt(objoffsetWidth)+(eventx mouseX);
mouseX=eventx;
objstyleheight=parseInt(objoffsetHeight)+(eventy mouseY);
mouseY= eventy;
objstylewidth=;
objstyleleft=objoffsetWidthobjoffsetWidth/;
objstyleheight=objclientHeight;
objstyleheight=objclientHeight;
objstyleleft=objclientWidth+w;
objstylewidth=screenwidthobjoffsetWidthw;
}}

function divonmousedown(){
mouseX = eventx;
mouseY = eventy;
}

function divonmouseup(){
objstyleleft=objoffsetWidth;
objstylewidth=w;
mouseX = ;
mouseY = ;}
</script>
<body style=margin:>
<iframe zindex= id="a" src=":;height:;position:absolute;zindex: "></iframe>
<div zindex= id=ab onmousemove=divonmousemove(); onmouseleave=documentgetElementById("ab")stylecursor=;
>
< table style="width:%;height:%;" border= cellspacing= cellpadding=px >
< tr>
< td style="width:px;" >
< iframe zindex= id="a" src=":%;height:%;zindex: "></iframe>
< /td>
< td style="width:px;cursor:eresize;backgroundcolor:#cccccc;" align="center" valign="middle"
onmousedown="Resize_mousedown(eventthis);" onmouseup="Resize_mouseup(eventthis);" onmousemove="Resize_mousemove(eventthis);">
<font style="size:px;backgroundcolor:#eeeeee;cursor:pointer;" onmousedown="Resize_setDefault(eventthis);"><</font>
< /td>
< td>
< iframe zindex= id="b" name="ContentFrame" src=":%;height:%;zindex:"></iframe>
< /td>
< /tr>
< /table>
< /body>

上一篇:JavaScript的模块化:封装(闭包),继承(原型) 介绍

下一篇:JS和jquery获取各种屏幕的宽度和高度的代码