易截截图软件、单文件、免安装、纯绿色、仅160KB

javascript 得到当前页面可视高度和宽度

function getHeight(){
    var yScroll;
    if (window.innerHeight && window.scrollMaxY) {
        yScroll = window.innerHeight + window.scrollMaxY;
    } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
        yScroll = document.body.scrollHeight;
    } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
        yScroll = document.body.offsetHeight;
    }
  
    var windowHeight;
    if (self.innerHeight) { // all except Explorer
        windowHeight = self.innerHeight;
    } else if (document.documentElement && document.documentElement.clientHeight) {
    // Explorer 6 Strict Mode
       windowHeight = document.documentElement.clientHeight;
    } else if (document.body) { // other Explorers
       windowHeight = document.body.clientHeight;
    }
    // for small pages with total height less then height of the viewport
    if(yScroll < windowHeight){
        pageHeight = windowHeight;
    } else {
        pageHeight = yScroll;
    }
      return pageHeight;
}
         
function getWidth(){
        var xScroll
        if (window.innerHeight && window.scrollMaxY) {
        xScroll = document.body.scrollWidth;
        } else if (document.body.scrollHeight > document.body.offsetHeight){ // all b


相关文档:

javascript的windows.open参数学习


<SCRIPT LANGUAGE="javascript">
<!--
window.open ('page.html', 'newwindow', 'height=100, width=400, top=0,left=0, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no')
file://写/成一行
-->
</SCRIPT>
参数解释:
<SCRIPT LANGUAGE="javascript"&g ......

JavaScript中arguments对象

今天头儿复查代码,结果发现有的页面并没有相应的DOM元素,导致调用fuction出错。采用JavaScript中arguments对象可以很轻松的解决这个问题,而不需要再去判断元素之类的。so Good!
JavaScript中arguments函数对象是该对象代表正在执行的函数和调用它的函数的参数。使用方法:
[function.]arguments[n ]
其中function是 ......

javascript 字符串处理


一、声明字符串:
var normal_monkey = "I am a monkey!<br>";
document.writeln("Normal monkey " + normal_monkey);
var bold_monkey = normal_monkey.bold();
document.writeln("Bold monkey "&n ......

如何避免Javascript事件绑定出现内存泄漏

"These memory leaks often
occur as a result of circular references between JavaScript objects and
objects within IE’s DOM (document object model)."
GPDE Team Blog
明显的DOM对象与 JavaScript对象循环引用很好判断,难的是隐含的循环引用判断!
隐含的循环引用需要通过作用域链进行分析判 ......

正则表达式 javascript网页开发

创建RegExp对象实例的两种方式
 
1.使用RegExp对象的显示构造函数,语法为:new RegExp("pattern")[,"flags"];
2.使用RegExp对象的隐示构造函数,语法为:/pattern/flags;
 
3.flags为以下标志字符的组合
 
(1).g作全局标志,如果没有,匹配第一个
 
(2). i 忽略大小写
 
(3).m 多行标志
正 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号