Compare Javascript-gathered value with a session variable

I know almost no Javascript. I got this from a script I found only and it just needs some minor tweaks…

I have a session variable I created from PHP. I need to compare it to a value entered in a form.

something like…

if(tempobj.value!= ??? SESSION VARIABLE ???)

How can I compare this variable to the entered value?