例子,php获取屏幕分辨率。
<? echo "<script type="text/javascript">var w = window.screen.width;document.cookie = "".$LOGIN_USER_ID."_sw = " + w;</script>"; $SCREEN_WIDTH = $_COOKIE[$LOGIN_USER_ID."_sw"]; switch(true) { case (int)$SCREEN_WIDTH-800<=0: $SHOW_VISIT_MSG = ""; break; case (int)$SCREEN_WIDTH-1024<=0: $SHOW_VISIT_MSG = ",上次登录:".format_datetime_short($LAST_VISIT_TIME); break; default: $SHOW_VISIT_MSG = "登入办公系统,上次登录时间:".format_datetime($LAST_VISIT_TIME); } //@setcookie($LOGIN_USER_ID."_sw",""); ?>