[Javascript] Re: export variables outside function

Lewis Shadoff lshadoff at brazosport.cc.tx.us
Fri Jan 3 15:08:51 CST 2003


You make a variable global in JavaScript by declaring it at the root 
level.  Your code will work if you add:

var windowOpen = "";
var x_poz = 0;

the line before the function declaration.

I would highly recommend changing the name of the function from open() 
(which is already a function built into JavaScript) to something like 
winOpen().  This is probably what is causing the problem.

Lew


At 12:01 PM 1/3/2003, you wrote:
>Message: 1
>From: "aw" <alfwro at wp.pl>
>To: javascript at LaTech.edu
>Date: Thu, 02 Jan 2003 21:04:40 +0100
>Subject: [Javascript] export variables outside function
>Reply-To: javascript at LaTech.edu
>
>Hi,
>I have problem with this function:
>
>function open(cityName) {
>var windowOpen = eval(cityName + "Obj");
>windowOpen.visibility = "visible"
>var x_poz = parseInt(windowOpen.left);
>
>if (x_poz <120) {
>windowOpen.left = x_poz +15;
>setTimeout("open()",1);
>}
>}
>
>So I have two question
>1. How to make it work, or




Lewis A. Shadoff, Ph.D.
Brazosport College
Lake Jackson, TX





More information about the Javascript mailing list