怎么样知道用户的浏览器所使用的分辨率是多少? <SCRIPT LANGUAGE="JavaScript1.2">function detect() { screen.width;}</SCRIPT> 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 这是在客户端用javascript实现的,PHP在服务器端,可以通过在javascript中设置cookie,在PHP中就可以得到这个值了。 <head><SCRIPT > sw=screen.width; sh=screen.height;</SCRIPT> </head> <form action="test.php" method=post> <input type=hidden name=sw> <input type=hidden name=sh> ... ... <input type=submit value="发送">//test.php<? echo "分辨率: ".$sw." x ".$sh;//如果用于程序 if ($sw < 1024) { ... ... }?> sw=screen.width楼上的你的程序好像没有把screen.width值赋给表单元素啊是不是该改改 <HTML><HEAD><TITLE>screen solution</TITLE><META http-equiv=Content-Type content="text/html; charset=gb2312"><SCRIPT language=JavaScript><!-- Beginfunction getscreen() {if ((screen.width == 640) && (screen.height == 480)) alert("现在显示器的分辨率是640*480");if ((screen.width == 800) && (screen.height == 600)) alert("现在显示器的分辨率是800*600");if ((screen.width == 1024) && (screen.height == 768)) alert("现在显示器的分辨率是1024*768");}// End --></SCRIPT></HEAD><BODY><input onClick=getscreen(); type=button value=查看当前分辩率></BODY></HTML> 除了用cookie 有没有跟好的方法把 js 的变量赋值给 php?? 如何利用php生成类似于股市的K线图 这样生成gif图片不动-PHP 如图,如何取指定时间段里面的数据? php页面对外攻击问题怎么解决 请问php操作文本文件更容易点还是操作数据库更方便一些呢? 用cookie的代碼問題 rmdir这个删除目录时提示权限不够,到底还要什么权限呢?高手帮忙,来者有分!!!! 我的本地配置出现了什么问题? 关于登陆后帧结构变化的问题 关于php调用access数据库的问题 在Oracle 7.3下,如何把一个大文本,存入数据库?数据库结构如下: 驳斥:从两点看PHP/ASP/JSP的区别
<SCRIPT >
sw=screen.width;
sh=screen.height;
</SCRIPT> </head> <form action="test.php" method=post>
<input type=hidden name=sw>
<input type=hidden name=sh>
... ...
<input type=submit value="发送">
//test.php<?
echo "分辨率: ".$sw." x ".$sh;
//如果用于程序
if ($sw < 1024)
{ ... ... }?>
楼上的
你的程序好像没有把screen.width值赋给表单元素啊
是不是该改改
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<SCRIPT language=JavaScript>
<!-- Begin
function getscreen() {
if ((screen.width == 640) && (screen.height == 480))
alert("现在显示器的分辨率是640*480");
if ((screen.width == 800) && (screen.height == 600))
alert("现在显示器的分辨率是800*600");
if ((screen.width == 1024) && (screen.height == 768))
alert("现在显示器的分辨率是1024*768");
}
// End -->
</SCRIPT>
</HEAD>
<BODY>
<input onClick=getscreen(); type=button value=查看当前分辩率>
</BODY></HTML>