Click to See Complete Forum and Search --> : need help with a line of code


abrakadabra
02-20-2003, 12:41 PM
Hi everyone,
I wanted to see if anyone can help me decipher this line of code.

window.location="pr.php?pass="+p1

I know what the window.location part of it is, and I also know that the pr.php parameter is passed to the window.location, but waht I don't understand the "pr.php?pass="+p1 as a whole. FYI the quotes are placed correctly.

Thanks!

Charles
02-20-2003, 12:50 PM
In JavaScript and ECMA 262 Script "[t]he addition operator either performs string concatenation or numeric addition." (From the ECMA 262 Spec.) Your line of code concatenates the string literal 'pr.php?pass=' with the value of the property p1 and then the browser makes an HTTP request for the result.

Nedals
02-20-2003, 09:51 PM
Mind if I try :) ,

window.location is getting the page "pr.php" which you understand.

....?pass="+p1 is a QUERY_STRING... pass='some variable in P1' that is passed for processing by PHP