`
fireq3
  • 浏览: 36312 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

浏览器中的js

 
阅读更多
判断浏览器的方法

一般常用方法是document.all
document.all能区分出FireFox,却无法区分Opera,因为Opera支持document.all.
但不支持,所以可以用下面的
if( document.all && window.external){
   //IE代码
}else{
  //其他
}

var Browser = {
'isIE' : (navigator.userAgent.indexOf('MSIE') >= 0) && (navigator.userAgent.indexOf('Opera') < 0),
'isFirefox' : navigator.userAgent.indexOf('Firefox') >= 0,
'isOpera' : navigator.userAgent.indexOf('Opera') >= 0
};

1.窗体操作
  moveBy(dx,dy) 相对移动,窗口左上角为原点.桌面左上角为终点
  moveTo(x,y) 使窗口的左上角移动到桌面的,x,y处
  resizeBy(dw,dh) 相对变化,以原来的大小增加,减小
  resizeTo(w,h) 把高度调为,w,h
 
  窗体大小及位置
  ie中的
  window.screenLeft
  window.screenTop
  document.body.offsetWidth
  document.body.offsetHeight
  其它
  window.screenX
  window.screenY
  window.innerWidth
  window.innerHeight
  window.outerWidth
  window.outerHeight

2.js中的暂停,与时间间隔
  暂停 var id = setTimeout(执行代码,暂停毫秒)
       clearTimeout(id); 取消暂停执行代码
  间隔 var id = setInterval(执行代码,暂停毫秒) 重复的间隔执行
       clearInterval(id);取消重复的间隔执行

  window.history.length
  window.history.go(1);
  window.history.back();
  window.history.foward();
 

 
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics