window.screen.width
window.screen.height
window.screen.height
解决方案 »
- 简述Php中cURL的使用
- PHP爬虫过程中获取页面的真实url
- Rewrite伪静态的这段正则如何写?
- 刚装Apache+php+mysqpl 不知如何配置Apache,不知如何配置配置C:\Apache2\conf\httpd.conf这个文件。(在线等)
- PHP中的::和->的意思,最好能对照VB来解释,我是才学PHP的,还请多帮忙。
- 各位DX帮忙,多谢
- URL参数中带有&字符怎么办?
- 如何获取一月是几号到几号?
- 大家好!怎样实现一个简单的自动检测系统?详细内容请进来看看!见者有分!
- 设置session必须写session_start()吗?
- 强人进!!我用mail()发邮件,请问,发送对象有数量有限制吗?
- 如何排序这个二维数组?
alert ('分辨率为 ' + screen.width + '×' + screen.height );
</script>
";
给个例子而已,你可以按实际应用
<?php
function hope1983()
{
echo "<script language=javascript>
alert ('分辨率为 ' + screen.width + '×' + screen.height );
</script>
";
}
$width=hope1983();
echo $width; //输出?>
<script language=javascript>
alert ('分辨率为 ' + screen.width + '×' + screen.height );
</script>不用写那段PHP程序了,我感觉只能通java来实现,在客户端生成一个页后java测到数值,赋给text,然后客户端再提交回服务,也许这样可以实现
PHP在服务器端运行,JS在客户端运行,PHP的值可以让JS调用,JS的值除了用表单提交,怎么可能让PHP调用呢。
<?php
if (isset($_GET['width']) AND isset($_GET['height'])) {
// output the geometry variables
echo "Screen width is: ". $_GET['width'] ."<br />\n";
echo "Screen height is: ". $_GET['height'] ."<br />\n";
} else {
// pass the geometry variables
// (preserve the original query string
// -- post variables will need to handled differently) echo "<script language=\"javascript\">\n";
echo " location.href=\"${_SERVER['SCRIPT_NAME']}?${_SERVER['QUERY_STRING']}"
. "&width=\" + screen.width + \"&height=\" + screen.height;\n";
echo "</script>\n";
exit();
}
?>
document.write(window.screen.width);
document.write(window.screen.height);
</script>
{
echo <<<EOT
<script language="javascript">
echo "<script language=\"JavaScript\">
w = window.screen.width;
h = window.screen.height;
self.location=self.location+\"?width=\"+w+\"&height=\"+h;</script>";
</script>
EOT;
exit();
}
?width=***&height=***也是怪怪的。