</pre><span style="white-space:pre"></span><pre name="code" class="javascript">//如果是手机浏览器,则跳到手机页面
var sUserAgent= navigator.userAgent.toLowerCase();
var bIsIpad= sUserAgent.match(/ipad/i) == "ipad"; //ipad
var bIsIphoneOs= sUserAgent.match(/iphone os/i) == "iphone os"; //iphone
var bIsMidp= sUserAgent.match(/midp/i) == "midp"; //移动设备
var bIsUc7= sUserAgent.match(/rv:1.2.3.4/i) == "rv:1.2.3.4";//
var bIsUc= sUserAgent.match(/ucweb/i) == "ucweb"; //ucweb浏览器
var bIsAndroid= sUserAgent.match(/android/i) == "android"; //abdroid
var bIsCE= sUserAgent.match(/windows ce/i) == "windows ce"; //windows ce移动系统
var bIsWM= sUserAgent.match(/windows mobile/i) == "windows mobile"; //windows mobile
if (bIsIpad || bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM) {
<span style="white-space:pre"> </span>window.location.href="http://www.baidu.com";
}
//浏览器宽度改变事件
window.onresize = function(){
//获取窗口宽度
if (window.innerWidth)
winWidth2 = window.innerWidth;
else if ((document.body) && (document.body.clientWidth))
<span style="white-space:pre"> </span>winWidth2 = document.body.clientWidth;
<span style="white-space:pre"> </span>}
//滚动条滚动事件
$(window).scroll(function(){
//获取当前页面的顶端到页面顶端的距离
winHeight = $(window).scrollTop();
<span style="white-space:pre"> </span>}