网页怎么根据用户屏幕大小自动调整网页宽度?

如题所述

第1个回答  推荐于2016-07-30
1 js可以用检测屏幕分辨率然后跳转的方法.检测屏幕宽度为800的时候跳转到800目录或者index1.html检测屏幕宽度为1024的时候跳转到1024目录或者index2.html检测屏幕宽度为1280的时候跳转到1280目录或者index3.html检测屏幕宽度为1440的时候跳转到1440目录或者index4.html你自己写好相应的几种宽度的网页即可.在asp网页制作中,根据分辨率自动调整网页宽度,无须用js编制类似以下的脚本:<script LANGUAGE="JavaScript"<!-- Beginfunction redirectPage(){var url800*600 = "800*600页面";var url1024*768 = "1024*768页面";var url1440*900 = "1440*900页面";if ((screen.width == 800) && (screen.height == 600))window.location.href= url800x600;else((screen.width == 1024) && (screen.height == 768))window.location.href= url1024x768;else((screen.width == 1440) && (screen.height == 900))window.location.href= url1440x900;}// End --定义表格宽度为100%:width:100%本回答被提问者采纳
相似回答