google N次 + 百度M次 + 试验了1605次之后(听说农药1605就是实验了这么多次后出来的),得出下面成果,在IE7及Firefox3里试了下还能凑合着用用! 1、首先给出个Iframe。 代码如下:<iframe id="ifrm" marginheight="0" marginwidth="0" height="100" width="1000" frameborder="0" scrolling="no" src="xxxxx.html"> </iframe> 2、然后看看怎么获取Iframe中的页面的高度。 其实最麻烦的就是怎么让获取的高度准确,不同的方式不同...
样式有点丑,为此,还重搞了个样式,哪知以为完工的时候,发现IE上工作不正常,自适应大小等无法实现。 原来它需要xhtml才行,而公司的产品是html的。为此,研究了一下自适应大小的实现。 原来一直觉得jquery取宽度高度很神奇,原来是直接取的dom中element的offsetWidth/offsetHeight等属性,当有element插入dom中,浏览器就会根据规则计算出相应的属性,这里抄几个相关的属性。 scrollWidth 是对象的实际内容的宽,不包边线宽度,...
无标题文档 function checkLength(which) { var maxchar=100; var oTextCount = document.getElementById("char"); iCount = which.value.replace(/[^\u0000-\u00ff]/g,"aa").length; if(iCount"+ iCount+""; which.style.border = '1px dotted #FF0000'; which.size=iCount+2; } else alert("请不要超过"+maxchar); } 0个字符 [Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]input高度固定,自动增宽 textarea宽度固定,自动增...
1.如果div想要一个最小高度,那么应该用css的minheight这个属性,但是IE不支持,考虑到大多数用户都使用IE,所以一般情况下这个属性基本上弃置不用。在IE里面,height基本上就可以当作minheight来用,因为如果内容超出height,IE会自适应其高度。但是一旦设置了 height以后,FIrefox就不会自适应div的高度了。所以只能两个属性都不用,干干净净地写<div>Jimbor Studio</div>。 2.即使不设置固定高度,Firefox对高度的自适应也不那么...
第一种方法: 代码如下:<script type="text/javascript" language="javascript"> <!-- //调整 PageContent 的高度 function TuneHeight() { var frm = document.getElementById("content01"); var subWeb = document.frames ? document.frames["content01"].document : frm.contentDocument; if(frm != null && subWeb != null) { frm.height = subWeb.body.scrollHeight; } } //--> </script> <iframe id="content01" name="conten...
假设主页面有一个div,里面放置一个iframe 代码如下:<div id="frameBox"> <iframe id="frameWin" src="1.html" name="opWin" style="width:100%; height:100% " frameborder="0" scrolling="no"></iframe> </div> 3个菜单链接,分别在iframe加载 1.html、2.html、3.html 三个页面。 3个子页面分别在自己页面加载完window.onload执行 代码如下:function aa(){ var newHeight = document.body.scrollHeight + 20 + "px"; window.pa...
function vvheight() { var sideleft=document.getElementById("content-left").scrollHeight; var sideright=document.getElementById("content-right").scrollHeight; layoutHeight=Math.max(sideleft,sideright); document.getElementById("content-left").style.height=layoutHeight+"px"; document.getElementById("content-right").style.height=layoutHeight+"px"; } 我想用脚本来控制自...
main.htm: 代码如下:<html> <head> <meta http-equiv='Content-Type' content='text/html; charset=gb2312'> <meta name='author' content='F.R.Huang(meizz梅花雪)//www.meizz.com'> <title>iframe自适应加载的页面高度</title> </head> <body> <iframe src="child.htm"></iframe> </body> </html>child.htm: <html> <head> <meta http-equiv='...
有时候,我们可能需要象新版的Yahoo邮箱一样,让一些数据显示块可以根据页面大小进行自适应。事实并不难,但是如果单纯用CSS控制的话,往往不能完全实现我们要的效果,这时候需要借助javascript,Javascript可以让我我们实现司空见怪的自适应页面,在iSunXoft的HR开源项目就应用到. 实现原理: 获取IE显示屏幕的宽高.确定哪些对象是绝对位置是固定的,那些是不固定的,哪些长宽是固定,然后象WIN FORM程序一样,根所软件界面...
main.htm: <html> <head> <meta http-equiv='Content-Type' content='text/html; charset=gb2312' /> <meta name='author' content='F.R.Huang(meizz梅花雪)//www.meizz.com' /> <title>iframe自适应加载的页面高度</title> </head> <body> <div><iframe src="child.htm"></iframe></div> </body> </html> child.htm: <html> <head> <meta http-equiv='Co...
iPop Demo iPop Demo This is a demo of the image popup script. I know you want to see it in action. Testing things with a small image. The popups have been setup with the AutoApply extension which will automatically apply iPop to all links to images within a document or within a section of the document. [Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]
<div class="TxtBox"> <iframe frameborder="0" scrolling="no" name="news1" id="news1" onload="if(document.frames['news1'].document.body.scrollHeight>document.frames['news2'].document.body.scrollHeight) document.all.news1.height=document.frames['news1'].document.body.scrollHeight;if(document.frames['news1'].document.body.scrollHeight<=document.frames['news2'].document.body.scrollHeight) document.all...
关于IFRAME 自适应高度的研究——之前自己也碰到过这个问题,为了得到答案去网上搜索,发现有不少人也遇到了这样的问题,现在就把解决方法共享一下。 重要提示:src=中你必须填写的网页地址,一定要和本页面在同一个站点上,否则,会抱错,说“拒绝访问!” 之前自己也碰到过这个问题,为了得到答案去网上搜索,发现有不少人也遇到了这样的问题,现在就把解决方法共享一下 超简单哦 1、建立一个bottom.js的文件,然后...
很多时候我们需要提供这样的功能给访问者:当访问者点击页面中的缩略图时,其对应的全尺寸图片将显示在一个新的弹出窗口中供访问者查看。 实现此功能的最简单作法是用以下HTML代码创建一个图像链接: <a href="fullsize.jpg" target="_blank"><img src="small.jpg"></a> 其中<a>标记的href属性指定全尺寸图片的URL,target属性设置为_blank指定在新窗口中显示该图片;<img>标记的src属性指定缩略图的URL。 如果我...
好几次看到有人提问问到如何实现 iframe 的自适应高度,能够随着页面的长度自动的适应以免除页面和 iframe 同时出现滚动条的现象,刚好我在工作中也碰到了类似问题,于是上网翻查,东抄抄西看看,弄出来这么一个函数,贴到页面里面就能用了。不敢独享,大家要是觉得有用,欢迎使用 源代码如下 代码如下:<script type="text/javascript"> //** iframe自动适应页面 **// //输入你希望根据页面高度自动调整高度的iframe的名称的列表...