PDA

View Full Version : would it be possible...


N!ck
10-13-2002, 04:45 AM
...to pass a javascript variable into php?

Neo
10-13-2002, 10:36 PM
$var = "<script type="Javascript">
var something;
something = "this";
</script>";

N!ck
10-13-2002, 11:47 PM
Originally posted by Neo

$var = "<script type="Javascript">
var something;
something = "this";
</script>";


wouldn't that just make the variable value


<script type="Javascript">
var something;
something = "this";
</script>


?

ivan2
10-14-2002, 09:26 PM
there you go

Neo
10-14-2002, 10:29 PM
Hmm good point I didnt think of that one.

Maybe try this

[php]

<script type="Javascript">
var something;
something = "this";
<?php $phpvar="/?> something <?php "/ ?>
</script>

??

Takara
10-15-2002, 12:46 AM
I don't think its possible since javascript is parsed after, by the browser. But what you could do is something like


<script language="JavaScript">
function pass() {
window.location("next.php?width=" + screen.width + "&height=" + screen.height + ");
}
</script>
<body onload="pass();">


Or something simmilar.