1、首先根据下方的代码,进行输入编辑。
<script type="text/javascript">
try{
if (/Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)) {
window.location.href="mindex.html"
2、然后继续根据下方的代码,进行输入编辑。
}else{
window.location.href="cindex.html"
}
}catch(e){}
</script>
3、然后这样就可以判断手机还是电脑登陆进入了。
给你一个例子,有这个就好办了。不会可参考“JS 判断浏览器客户端类型”
<script type="text/javascript">var bForcepc = fGetQuery("dv") == "pc"//PC端
function fBrowserRedirect(){
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"//android
var bIsCE = sUserAgent.match(/windows ce/i) == "windows ce" //windows ce移动系统
var bIsWM = sUserAgent.match(/windows mobile/i) == "windows mobile"//windows mobile
if(bIsIpad){
var sUrl = location.href
if(!bForcepc){
window.location.href = "ipad"
}
}
if(bIsIphoneOs || bIsAndroid){
var sUrl = location.href
if(!bForcepc){
window.location.href = "smart"
}
}
if(bIsMidp||bIsUc7||bIsUc||bIsCE||bIsWM){
var sUrl = location.href
if(!bForcepc){
window.location.href = "m"
}
}
}
function fGetQuery(name){//获取参数值
var sUrl = window.location.search.substr(1)
var r = sUrl.match(new RegExp("(^|&)" + name + "=([^&]*)(&|$)"))
return (r == null ? null : (r[2]))
}
function fShowVerBlock(){
if(bForcepc){
document.getElementByIdx_x("dv_block").style.display = "block"
}
else{
document.getElementByIdx_x("ad_block").style.display = "block"
}
}
fBrowserRedirect()
</script>
1、首先准备一个HTML结构的文档,页面可以制作的简单点。
2、然后在页面的body区域中放置一个img图片。
3、我们先来运行一下页面,你会在页面中看到如下图所示的圆圈。
4、接下来我们就需要对页面进行CSS处理,如下图所示,给img图片添加样式,注意里面有旋转样式。
5、然后实现旋转的设置,这个是CSS3的新功能,主要是对图片进行旋转度数的设置。
6、最后运行程序,你会看到页面中的圆圈在不停的旋转,和我们平常看到的加载中的效果很像。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)