Forum Moderators: open

Message Too Old, No Replies

swin/sWin?

         

Tir Tinuviel

9:43 pm on Feb 17, 2004 (gmt 0)

10+ Year Member



What does "swin" or "sWin" mean?

i.e.

swin = window.open("print.htm","swin","width=300,height=400,scrollbars=yes,resizable=yes,top=" + topPos + ",left=" + leftPos);

Purple Martin

10:00 pm on Feb 17, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It is a user-defined variable that holds a value equal to the result of the expression on the right.

In JavaScript you don't have to explicitly declare variables like you do in most languages. The first time you use a new variable name, it is automatically declared. The variable type (either string or numeric) is implied by the first value assigned to the variable.

The code could have been written like this (which means exactly the same thing):
var swin = window.open.....etc

diades

10:10 pm on Feb 17, 2004 (gmt 0)

10+ Year Member



var swin = window.open.....etc

I hope that you do not mind me pointing out that whilst are the "same" as regards being variables they are of differing scope if used within a function:

swin = window.open.....etc
var swin = window.open.....etc

swin is of global scope and will be available to all functions etc., as long as that page is loaded whereas var swin is of local scope to that function and only exists whilst that function is called.

Tir Tinuviel

10:34 pm on Feb 17, 2004 (gmt 0)

10+ Year Member



ahh, cheers! :)