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>

 

你可能感兴趣的:(js)