js判断加载大小页面

大页面里的js:

<script>
function jmp(){
    var w = document.body.clientWidth;
    if( w > window.screen.width){
        w = window.screen.width;
    };
    if( w < 1003){
        window.location.href="2.html"
    };
}
window.onresize = jmp;
jmp();
</script>

小页面里的js:

<script>
function jmp(){
    var w = document.body.clientWidth;
    if( w > window.screen.width){
        w = window.screen.width;
    };
    if( w > 1003){
        window.location.href="1.html"
    };
}
window.onresize = jmp;
jmp();
</script>

 

posted @ 2014-03-13 23:16  Joerias  阅读(487)  评论(0编辑  收藏  举报