Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_web_howto thread: how to handle globe data in javascript files in html?


Message #1 by Lin Ma <linma@b...> on Wed, 31 Jan 2001 07:50:30 -0500
This message is in MIME format. Since your mail reader does not understand

this format, some or all of this message may not be legible.



------_=_NextPart_001_01C08B84.64B2B070

Content-Type: text/plain;

	charset="iso-8859-1"







Hi,

How do the globe data defined in .js file behaviour? (compare with those in

dll)



i.e. in a.js file, if it is like:

-------------------------------------

//a.js

var g_Array = new Array();

var g_Index = 0;



function OtherObj()

{

	this.Var1 = null;

	this.Var2 = null;

}



function Action( s )

{

	var otemp = new OtherObj();

	otemp.Var1 = function(){alert("f1");}

	otemp.Var2 = function(){alert(s);}

	

	g_Array[g_index++] = otemp;	

}



function FnUsingData(i)

{

	//will accessing data from g_Array

	g_Array[i].Var1;

	g_Array[i].Var2;

}

------------------------------------------------

question 1:

if load this a.js in one html(or asp), 

and do new "Action" more than once, is the g_Array shared by all "Action"

object in this html? is there problem of doing so?



question2:

if load this a.js in diffeent html but in one application, will this a.js be

loaded multiple times or only once and the g_Array will be shared by all of

these html? Is there critical condition for the globes? Who is going to

clean the globes?



question 3:

is there way to load a.js file only once( detect if it is already loaded

then just use it)?



Appreciate your help!





  Return to Index