zoukankan
html css js c++ java
使用iframe和table模拟frameset的resize功能.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <TITLE>iframe和table模拟frameset的resize功能</TITLE> <META NAME="Generator" CONTENT="EditPlus"> <META NAME="Author" CONTENT=""> <META NAME="Keywords" CONTENT=""> <META NAME="Description" CONTENT=""> </HEAD> <BODY> <table id="main" style="100%; height:100%" cellSpacing="0" cellPadding="0" border="0"> <tr> <td style="125px" id="tdLeft"> <iframe id="ifmLeft" style="125px; height:100%" src="http://www.google.com" frameBorder="0" scrolling="auto"></iframe> </td> <td id="tdResizer" style="2px; cursor:e-resize; background-color:#A1C7F9;"> </td> <td width="100%"> <iframe id="ifmRight" style="100%; height:100%" src="http://www.baidu.com" frameBorder="0" scrolling="auto"></iframe> </td> </tr> </table> <script language="javaScript"> var theResizeObj = null; //代表一个 resizeObject() 的实例 This gets a value as soon as a resize start function resizeObject() { this.target = null; //需要 resize 的 object //this.dir = ""; //移动方向 type of current resize (n, s, e, w, ne, nw, se, sw) this.mouseOld_X = null; //鼠标移动时初始 x 坐标 this.mouseOld_Y = null; //鼠标移动时初始 y 坐标 this.oldWidth = null; //需要 resize 的 object 初始 width this.oldHeight = null; //需要 resize 的 object 初始 height //this.oldLeft = null; //定位用的 //this.oldTop = null; this.xMin = 1; //The smallest width possible this.yMin = 1; //The smallest height possible this.xMax = window.screen.availWidth * 0.95; //the max width possible } //准备拖动 function resizeStart() { if(window.event.srcElement.id == "tdResizer") { theResizeObj = new resizeObject(); theResizeObj.target = document.all("ifmLeft"); theResizeObj.mouseOld_X = event.clientX; theResizeObj.oldWidth = theResizeObj.target.offsetWidth; } else { theResizeObj = null; } window.event.returnValue = false; window.event.cancelBubble = true; document.all('tdResizer').setCapture(); } //拖动 function resize() { if(theResizeObj != null) { var newWidth = theResizeObj.oldWidth + window.event.clientX - theResizeObj.mouseOld_X; newWidth = Math.min(newWidth, theResizeObj.xMax); newWidth = Math.max(newWidth, theResizeObj.xMin); theResizeObj.target.style.width = newWidth + "px"; } window.event.returnValue = false; window.event.cancelBubble = true; } //停止拖动; function resizeStop() { if(theResizeObj != null) { theResizeObj = null; } //释放鼠标拖动 document.all('tdResizer').releaseCapture(); } document.onmousedown = resizeStart; document.onmousemove = resize; document.onmouseup = resizeStop; </script> </BODY> </HTML>
参考资料:
http://www.gimoo.net/html/manual/%E5%A4%9A%E5%AA%92%E4%BD%93%E4%B8%8E%E7%BB%BC%E5%90%88%E6%8A%80%E5%B7%A7/%E5%8A%A8%E6%80%81%E6%94%B9%E5%8F%98%E5%AE%B9%E5%99%A8%E5%A4%A7%E5%B0%8F.htm
(注意:他的脚本挂了马,请小心使用.下面是安全的脚本)
genresize.js
查看全文
相关阅读:
F#周报2019年第33期
The .NET World——gPRC概览
编程杂谈——Non-breaking space
F#周报2019年第32期
F#周报2019年第31期
F#周报2019年第30期
pat 乙级 1015. 德才论 (25) c++
pat 乙级 1008. 数组元素循环右移问题 (20)
PAT 乙级 1007. 素数对猜想 (20) c++ 筛选法求素数
PAT-B 1005. 继续(3n+1)猜想 (25) c++
原文地址:https://www.cnblogs.com/focus/p/961045.html
最新文章
Linux学习笔记之Linux命令
Python学习日记之文件读取操作
DVWA系列精品教程:2、命令注入
让我来告诉你,学习大数据都是要安装哪些软件
用最新的版本,蹦最野的迪~~~IDE写大数据程序避坑指南
谁给你说的 Ubuntu 不可以输入中文
python 程序双击执行的小技巧
学习笔记,每日打卡,持续更新
spark 独立应用编程之 Java 编程
必学的密码学基本知识
热门文章
几行代码能搞定的事不必去点鼠标
pip 命令参数以及如何配置国内镜像源
推荐一个高效,易用功能强大的可视化API管理平台
搭建Elk集群搭建 ES-filebeat-logstrash-kibana
c#6.0新语法
高扩展性网站的50条原则
F#周报2019年第37期
F#周报2019年第35期
F#周报2019年第34期
编程杂谈——Platform target x64
Copyright © 2011-2022 走看看