js获取页面高度赋值给div
<script type="text/javascript">
window.onload=function(){
map_width=document.body.clientWidth;//获取body宽度
map_height=document.documentElement.clientHeight;//获取页面可见高度
//alert(map_width);
//alert(map_height);
//下面两行最后的"px"必须加上,折腾了半天老是不显示添加的style,最后就是错在这了
document.getElementByIdx_x_x("maps").style.width=map_width+"px";
document.getElementByIdx_x_x("maps").style.height=map_height+"px"; }
</script>
function iframeHeight(iframeId,change) {
var ifm= document.getElementById(iframeId);
ifm.name=iframeId;
var clientHeight=document.documentElement.clientHeight;
clientHeight=clientHeight-change;
var subWeb = document.frames ? document.frames[iframeId].document : ifm.contentDocument;
if(ifm != null && subWeb != null) {
var scrollHeight=subWeb.body.scrollHeight;
if(scrollHeight>clientHeight){
ifm.height = clientHeight;
}else{
ifm.height = scrollHeight;
}
}
}
js获取页面高度赋值给div的更多相关文章
- jquery、js获取页面高度宽度等
jquery获取页面高度宽度 //获取浏览器显示区域(可视区域)的高度 : $(window).height(); //获取浏览器显示区域(可视区域)的宽度 : $(window).width(); ...
- js 获取页面高度和宽度(兼容 ie firefox chrome),获取鼠标点击位置
<script> //得到页面高度 var yScroll = (document.documentElement.scrollHeight >document.documentEl ...
- js获取页面高度
<script> function getInfo() { var s = ""; s += " 网页可见区域宽:"+ document.body. ...
- js里获取页面高度和文档高度
$(window).height() 和 $(document).height()的区别 $(window).height()代表了当前可见区域的大小,$(document).height()则代表了 ...
- 使用js获取页面的各种高度
使用js获取相关高度: 获取网页被滚动条卷去的高度——兼容写法: scrollHeight = documen.body.scrollTop || document.documentElement.s ...
- js获取浏览器高度和宽度值,尽量的考虑了多浏览器。
js获取浏览器高度和宽度值,尽量的考虑了多浏览器. IE中: document.body.clientWidth ==> BODY对象宽度 document.body.clientHeight ...
- 【转】js 获取浏览器高度和宽度值(多浏览器
原文地址:http://www.jb51.net/article/19844.htm js获取浏览器高度和宽度值,尽量的考虑了多浏览器. IE中: document.body.clientWidth ...
- js获取页面所有搜索条件
<div class="search"> 产品简码:@Html.TextBox("ProCode", "") ...
- JS基础入门篇( 三 )—使用JS获取页面中某个元素的4种方法以及之间的差别( 一 )
1.使用JS获取页面中某个元素的4种方法 1.通过id名获取元素 document.getElementById("id名"); 2.通过class名获取元素 document.g ...
随机推荐
- SpringMVC注解@RequestParam全面解析
在SpringMVC后台控制层获取参数的方式主要有两种,一种是request.getParameter("name"),另外一种是用注解@RequestParam直接获取.这里主要 ...
- [转]关于安装hadoop中出现的的 $HADOOP_HOME is deprecated 的解决方法
当前用户的.bash_profile在/home/用户/下,系统的.bash_profile在/etc/skel目录下; 默认可能是隐藏的:有人会问了,隐藏的我怎么打开它,一个简单的办法,直接使用vi ...
- poj: 1003
简单题 #include <iostream> #include <stdio.h> #include <string.h> #include <stack& ...
- C++新手之详细介绍MFC
MFC (Microsoft Foundation Class Library)中的各种类结合起来构成了一个应用程序框架,它的目的就是让程序员在此基础上来建立Windows下的应用程序,这是一种相对 ...
- 使用 nano 的时候提示找不到 libncursesw.so.5 这个共享库
由于拿nano来练习pacman这个包管理系统,也就是卸了装,装了卸.但是后来当我想用 nano 编辑文件的时候,系统提示标题上说的这错误. 不知道做了什么,难道是误删了什么东西...后来几番搜索,用 ...
- location.reload()加载时有弹出框
解决办法: 1.试试 window.location.href=window.location.href 2.当前页有被post数据的时候reload就会提示刷新 可以尝试重新定向页面地址 3.rel ...
- Visual studio 中编译错误SQL71006: Only one statement is allowed per batch. A batch separator, such as 'GO', might be required between statements.
把写好的sql脚本,并在mssqlmanager里面编译成功的存储过程脚本复制到vs项目下,出现错误信息如下:SQL71006: Only one statement is allowed per b ...
- html规范整体结构
<!DOCTYPE html><html lang="zh"><head> <meta charset="utf-8" ...
- loadrunner具体实例教你如何进行结果分析
1.对于吞吐量,单位时间内吞吐量越大,说明服务器的处理能越好,而请求数仅表示客户端向服务器发出的请求数,与吞吐量一般是成正比关系. 2.一般瓶颈应该就是某个因素在不断增加,某个相关性能指标也会不断增加 ...
- Delphi 取得桌面文件夹的路径和取得我的文档的路径
Uses Windows,Registry; function GetShellFolders(strDir: string): string; const regPath = '\Software\ ...