javascript获取浏览器的宽度和高度
<script language="JavaScript" type="text/JavaScript">
<!--
function displayScreenSize()
{
var bodyWidth =document.body.clientWidth; //网页可见区域宽
var bodyHeight =document.body.clientHeight; //网页可见区域高
var bodyWidthWithBorder =document.body.offsetWidth; //网页可见区域宽(包括边线的宽)
var bodyHeightWithBorder=document.body.offsetHeight; //网页可见区域高(包括边线的宽)
var bodyWidthWithScroll =document.body.scrollWidth; //网页正文全文宽
var bodyHeightWithScroll=document.body.scrollHeight; //网页正文全文高
var bodyTopHeight =document.body.scrollTop; //网页被卷去的上边距
var bodyLeftWidth =document.body.scrollLeft; //网页被卷去的左边距
相关文档:
大家可能都遇到过在写javascirpt代码时传递中文,在后台取到时发现是乱码,这里把我今天做的方法写出来,希望对大家以后有用!
方法(一):
html页面:
function testOne() {
var url = "testOne_test.do?expr="+你好;
location = encodeURI(url);
}
后台java代码:
String expr = ne ......
/*
* JavaScript对象就是一组属性(方法)的集合
* 在该语言中如果变量名或方法名不符合声明规范,
* 则一定得用方括号“ [] ”引用它
*
*/
/**
* <1.>该语句声明了一个class1类,class1相当于构造方法,又叫构造器
* 也可说声明了一个class1方法
......
原创于2007年12月16日,2009年10月15日迁移至此。
JavaScript通过内置的setTimeout函数来完成页面内的定时检查,也是很久以前写的东西了。
之所以想起它来,是因为在和项目组其他成员说该事情的时候,别人竟然嘲笑我说是上个世纪的代码,现在都用WEB2.0了。
<script language="JavaScript" type="text ......
scrollHeight: 获取对象的滚动高度。
scrollLeft:设置或获取位于对象左边界和窗口中目前可见内容的最左端之间的距离
scrollTop:设置或获取位于对象最顶端和窗口中可见内容的最顶端之间的距离
scrollWidth:获取对象的滚动宽度
offsetHeight:获取对象相对于版面或由父坐标 offsetParent 属性指定的父坐标的高度
offsetL ......