错误跳转js

<script type="text/javascript">
var t = 5; //倒计时的秒数
function showTime(){
document.getElementById('time').innerHTML= t +"S后跳转到首页";
if(t==0){
var ua = navigator.userAgent;
if(ua.indexOf('iPhone')>=0){
window.location.href="openApp.jdmobile://virtual?params={\"category\":\"jump\",\"des\":\"HomePage\"}";
}
if(ua.indexOf('android')>=0){
window.location.href="openApp.jdMobile://360buy?type=1";
}
else {
window.location.href="http://m.jd.com";
}
}
t -= 1;
if(t>=0){
setTimeout("showTime()",1000);
}
}
window.onload=function(){ showTime();
}
</script>

posted @ 2017-03-14 17:52  杉枫  阅读(1255)  评论(0编辑  收藏  举报