根据访问端显示页面上半部分隐藏下半部分 电脑上半部分 手机下半部分

IT
0 1108
haoyunlai
2018-08-25

<meta charset="utf-8">
<div id="sbbf">上半部分</div>
<div id="xbbf">下半部分<<span class="hljs-regexp">/div>

	function IsPC() {
		var userAgentInfo = navigator.userAgent;
		var Agents = ["Android", "iPhone",
					"SymbianOS", "Windows Phone",
					"iPad", "iPod"];
		var flag = true;
		for (var v = 0; v  0) {
				flag = false;
				break;
			}
		}
		return flag;
	}
    function $(id){
        return document.getElementById(id);
    }
    if(IsPC()){
        $("sbbf").style.display = "block";
        $("xbbf").style.display = "none";
    }
    else{
        $("sbbf").style.display = "none";
        $("xbbf").style.display = "block";
    }
</script>


回帖