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; //网页被卷去的左边距
相关文档:
/*
* To change this template, choose Tools | Templates
* and open the template in the editor
*/
var File = {
name:'',
path:'',
ext:'',
cfiles:[],
attributes:{
  ......
下面两个方法实现了数组中去掉 前面 或者 后面的 重复项
去掉前面的重复项方法 把array [1, 2, 3, 1, 4, 5]去掉前面重复项 得到 [2, 3, 1, 4, 5].
function unique(a)
{
var r = new Array();
o:for(var i = 0, n = a.length; i < n; i++) {
for(var x = i + 1 ; x < n; x++)
{
......
Javascript 正则表达式使用手册
Javascript 2008-10-30 10:15 阅读97 评论0
字号: 大大 中中 小小
一.正则表达式匹配常用语法
“+”字符:规定表达式字符出现一次或多次。
“*”字符:规定表达式字符出现零次或多次。
“? ......
<SCRIPT LANGUAGE="JavaScript">
<!--
function limitNum(obj) {
if(obj.value.replace(/\s/g,"")==""||obj.value.replace(/\s/g,"")=="输入关键字") {
alert('请输入关键字')
return false;
}
}
//-->
</SCRIPT>
< ......
javascript修改IMG标签的SRC实现验证码时,IE正常,火狐和google出状况
1.当点击某一按钮的时候,把图片域中的图片改变一下
<img id="randimg" src="/servlet/CreateValidateNum" width="60" height="20" />
<span style="cursor:hand" onclick="reflush();return false; ......