易截截图软件、单文件、免安装、纯绿色、仅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事件绑定出现内存泄漏

"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 显示标签页效果

要实现这个功能关键是要理解块的display属性。一个块的display属性设为none,就相当于这个块不存在。所以将要显示的多个块的display属性设为none,再根据需要将要显示的块的display属性设为block就可以做出标签页效果了。
(1)      建标签题以及各标签题所对应的显示内容:
<span id="span1 ......

javascript cookies操作


javascript cookies操作
<script>
//写cookies函数 作者:翟振凯
function SetCookie(name,value)//两个参数,一个是cookie的名子,一个是值
{
    var Days = 30; //此 cookie 将被保存 30 天
    var exp  = new Date();    //new Date("December 31, 9998");
&n ......

JavaScript验证正则表达式大全

JavaScript验证正则表达式大全
匹配中文字符的正则表达式: [\u4E00-\uFA29]
评注:匹配中文还真是个头疼的事,有了这个表达式就好办了
匹配双字节字符(包括汉字在内):[^x00-xff]
评注:可以用来计算字符串的长度(一个双字节字符长度计2,ASCII字符计1)
匹配空白行的正则表达式:ns*r
评注:可以用来删除空白行
......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号