你用document.write()将变量写到一个img的src连接串中。给你看个例子吧:)<script language="javascript">
scrw=screen.width
scrh=screen.height
document.write("<img src=\count.php?scrw="+scrw +"&scrh=" +scrh + "\" width=0 height=0 border=0 alt=\"\">");
</script>
scrw=screen.width
scrh=screen.height
document.write("<img src=\count.php?scrw="+scrw +"&scrh=" +scrh + "\" width=0 height=0 border=0 alt=\"\">");
</script>
<script language="javascript">
scrw=screen.width
scrh=screen.height
document.write("<img src=\"count.php?scrw="+scrw +"&scrh=" +scrh + "\" width=0 height=0 border=0 alt=\"\">");
</script>
但收不到
<?
if($submit){
print_r($arrayVal);
echo "<br>";
print_r($arrayLength);
echo "<br>";
echo gettype($arrayVal);
echo "<br>";
$arrayVal=explode(",",$arrayVal);
print_r($arrayVal);
}
?>
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
</HEAD><BODY>
<FORM METHOD=POST ACTION=<?=$PHP_SELF?> onsubmit="return checkform(this)">
<INPUT TYPE="hidden" NAME=arrayVal>
<INPUT TYPE="hidden" NAME=arrayLength>
<INPUT TYPE="submit" name=submit value="矗ユ"></FORM>
</BODY>
</HTML>
<script>
var arrayA=new Array("a","b","c");
function checkform(form)
{
form.arrayLength.value=arrayA.length;
form.arrayVal.value=arrayA;
}
</script>
提交前將數組付給form的一個隱藏控件,控件值為數組所有的元素用逗號分開的字符串,提交到php以後再用explode函數還原即可