[thelist] Javascript Help Needed

Locke huinei03 at softhome.net
Tue May 14 20:47:01 CDT 2002

----- Original Message -----
From: "Ben Henick" <persist1 at io.com>
To: <thelist at lists.evolt.org>
Sent: Tuesday, May 14, 2002 5:54 PM

> > <chuckle> The onClick function is about as simple as I can make it. It
> > that may be the root of the problem here. It just loads an image from an
> > array based on 3 variables set by user input.
> Uh-huh.
> What you need are the environmental data:
> 1.  Which quadrant is in focus?
> 2.  Which layer(s) are set to true?
> If you know which quadrant is in focus, you can put the adjacent quadrants
> behind your event handlers, which takes care of criterion #1.
> There's no reason why you can't hold your layer state in a static array,
> which takes care of criterion #2.
> When the oncklick/href function fires, re-evaluate that data and execute
> something like this:
> randomblahblah = new Image();
> randomblahblah.src = // parsed and reassembled from function arguments;
>                      // probably set equivalent to a variable beforehand
> document.images["map_view"].src = // same as previous line
> Provided the user's caching is set up properly, extensive use of the back
> button (or other methods of re-traversing data) can be called directly
> from the cache.  Meanwhile, there is no abuse of preloading, so
> everybody's happy.

I -just- finised the re-write of the code when I got this email, heh. I see
how that would solve my problems, but I was able to handle it a different
way. I created a couple functions to spit out the needed file locations as
strings, and replaced the image sorce as needed. I'm not sure if this
replaces and reloads the images each time, but it sure as hell doesn't do
any pre-loads.

 function change()
  r = political.list.value;
  Parse1(1, smallnav, r);
  if ((political.list.value == 0)||(mainnav == 0))
   document.layer1.src = "images/spacer.gif"; <!-- make it empty  so user
// have to see little red 'x'-->
   document.layer1.src = txt1+'-'+mainnav+'-'+txt2+'.gif';
  document.label1.src = label1Array[political.list.value].src;
  document.leg1.src = legend1[political.list.value].src;

If you don't mind .. I could use someone's input as to whether or not this
lodas in an efficient manner.

http --
or, ftp -- ftp://friend:password@


More information about the thelist mailing list