通过页面重载
<?php
if(!$_GET["screenX"]) {
echo '
<script>
location = location.href+"?screenX="+screen.width+"&screenY="+screen.height;
</script>
';
exit;
}
$screenX = $_GET["screenX"];
$screenY = $_GET["screenY"];
?>
以下是其他内容
<?php
if(!$_GET["screenX"]) {
echo '
<script>
location = location.href+"?screenX="+screen.width+"&screenY="+screen.height;
</script>
';
exit;
}
$screenX = $_GET["screenX"];
$screenY = $_GET["screenY"];
?>
以下是其他内容
function newWind()
{
var x = window.screen.width;
var y = window.screen.height;
x =(x - 300) / 2;
y =(y - 250) / 2;
window.open(”1.html”,’’,”top=” + y + ”,left=” + x);
}
</script>
我拷贝了这段代码到程序中,可以读出来了
<?php
if(!$_GET["screenX"]) {
echo '
<script>
location = location.href+"?screenX="+screen.width+"&screenY="+screen.height;
</script>
';
exit;
}
$screenX = $_GET["screenX"];
$screenY = $_GET["screenY"];
?>但是
用另外一个页面调用这个程序,
<script src="http://192.168.3.125/countphp/stat.php"></script>
就提示
<script>
location = location.href+"?screenX="+screen.width+"&screenY="+screen.height;
</script>请教如何解决这个问题
如果去掉stat.php中的<script >
则死循环,求救啊
应该是JS的问题,还有其他方法得到这样的屏宽吗?
或者如何修正,因为我这个程序要被其他页面调用的!
谢谢了
我用B页面调用A程序时
得到B页面的HTTP地址怎么得到
好象调用时候,我只能得到A程序的HTTP地址…………
用image对象
<script>
screenX = screen.width;
screenY = screen.height;
info = "tmp_ide.php?screenX="+screen.width+"&screenY="+screen.height;
tmp = new Image(10,10);
tmp.src = info;
</script>
用隐藏框架
<script>
screenX = screen.width;
screenY = screen.height;
info = "tmp_ide.php?screenX="+screen.width+"&screenY="+screen.height;
document.write("<iframe src='"+info+"' style='Visibility:hidden'></iframe>");
</script>其中tmp_ide.php用于接收传递过来的信息
加上我楼上的方法,根据情况选用。