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
查看全文
相关阅读:
CSP2019题解
[NOI2019]弹跳(KD-Tree)
集合框架面试题
注解
WiFi攻防
简单完整讲述Servlet生命周期
Java多线程
Java--面向对象讲解
layUi
java提高篇(三)-----理解java的三大特性之多态
原文地址:https://www.cnblogs.com/focus/p/961045.html
最新文章
Codeforces Round #630 (Div. 2)
最近公共祖先 LCA 模板
【堆排 && 思路】数据结构实验之排序四:寻找大富翁
【堆 && 哈弗曼树】树-堆结构练习——合并果子之哈夫曼树
【平衡二叉树】数据结构实验之查找二:平衡二叉树
【二叉树】数据结构实验之二叉树的建立与遍历 2136
【栈 && 单调栈】浅谈单调栈与单调栈的理解
【简单dp】2080->最长公共子序列问题 动态规划
【经典】单调队列+尺取法——leetcode 和至少为 K 的最短子数组
【思维】快慢指针——LEETCODE环形链表 II
热门文章
【经典】矩阵快速幂加速dp递推——namomo #1 c
【思维】dfs树/求最小环——cf 1364D
【随机】概率分析——cf1364E
【思维】图论+时间戳——Gym
计算几何多边形面积——swerc Gym
【思维】迪杰斯特拉升维dp—— swerc Gym
Codeforces Round #657 (Div. 2)垫底记
Codeforces Round #655 (Div. 2)题解
Codeforces Round #656 (Div. 3)垫底祭
AIsing Programming Contest 2020被吊打记
Copyright © 2011-2022 走看看