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
查看全文
相关阅读:
linux系统中如何进入退出vim编辑器,方法及区别
[转]JAVA的动态代理机制及Spring的实现方式
mybaties 缓存
全面分析 Spring 的编程式事务管理及声明式事务管理
面试(4)-spring-Spring面试题和答案
vector的多套遍历方案
【QT】QT下载与安装
【QT】无需写connect代码关联信号和槽函数
【QT】第一个QT程序(点击按钮,显示特定文本)
【QT】error: 'SIGNAL' was not declared in this scope
原文地址:https://www.cnblogs.com/focus/p/961045.html
最新文章
JDK 伪异步编程(线程池)
JDK BIO编程
Java调优经验谈
Spring常用工具类
Java堆外内存的使用
算法笔记_104:蓝桥杯练习 算法提高 新建Microsoft Word文档(Java)
算法笔记_103:蓝桥杯练习 算法提高 金明的预算方案(Java)
算法笔记_102:蓝桥杯练习 算法提高 快乐司机(Java)
算法笔记_101:蓝桥杯练习 算法提高 身份证号码升级(Java)
算法笔记_100:蓝桥杯练习 算法提高 三个整数的排序(Java)
热门文章
算法笔记_099:蓝桥杯练习 算法提高 排列数(Java)
算法笔记_098:蓝桥杯练习 算法提高 盾神与条状项链(Java)
算法笔记_097:蓝桥杯练习 算法提高 P1001(Java)
算法笔记_096:蓝桥杯练习 算法提高 求最大值(Java)
算法笔记_095:蓝桥杯练习 拿糖果(Java)
Linux下关闭JBoss实例
JBoss7 如何用脚本 启动 和 停止
linux开发常用命令
在JBoss AS7中进行项目部署
JBoss7安装、测试、配置和启动以及停止,部署
Copyright © 2011-2022 走看看