// 判断屏幕是否旋转
function orientationChange() { 
    switch(window.orientation) { 
      case 0:  
            alert("肖像模式 0,screen-width: " + screen.width + "; screen-height:" + screen.height); 
            break; 
      case -90:  
            alert("左旋 -90,screen-width: " + screen.width + "; screen-height:" + screen.height); 
            break; 
      case 90:    
            alert("右旋 90,screen-width: " + screen.width + "; screen-height:" + screen.height); 
            break; 
      case 180:    
          alert("风景模式 180,screen-width: " + screen.width + "; screen-height:" + screen.height); 
          break; 
    };<br>};
// 添加事件监听 
addEventListener('load', function(){ 
    orientationChange(); 
    window.onorientationchange = orientationChange; 
});
5. 隐藏地址栏 & 处理事件的时候,防止滚动条出现:
复制代码 代码如下:
// 隐藏地址栏  & 处理事件的时候 ,防止滚动条出现
addEventListener('load', function(){ 
        setTimeout(function(){ window.scrollTo(0, 1); }, 100); 
});
6. 双手指滑动事件:
复制代码 代码如下:
// 双手指滑动事件
addEventListener('load',  function(){ window.onmousewheel = twoFingerScroll;}, 
     false              // 兼容各浏览器,表示在冒泡阶段调用事件处理程序 (true 捕获阶段)
); 
function twoFingerScroll(ev) { 
    var delta =ev.wheelDelta/120;              //对 delta 值进行判断(比如正负) ,而后执行相应操作 
    return true; 
}; 
7. 判断是否为iPhone:
复制代码 代码如下:
// 判断是否为 iPhone : 
function isAppleMobile() { 
    return (navigator.platform.indexOf('iPad') != -1); 
}; 
8. localStorage:
例子 :(注意数据名称  n  要用引号引起来)
复制代码 代码如下:
var v = localStorage.getItem('n') ? localStorage.getItem('n') : "";   // 如果名称是  n 的数据存在 ,则将其读出 ,赋予变量  v  。 
localStorage.setItem('n', v);                                           // 写入名称为 n、值为  v  的数据 
localStorage.removeItem('n');                                           // 删除名称为  n  的数据    
9. 使用特殊链接:
如果你关闭自动识别后 ,又希望某些电话号码能够链接到 iPhone 的拨号功能 ,那么可以通过这样来声明电话链接 ,
复制代码 代码如下:
