[thelist] Javascript Help Needed

Locke huinei03 at softhome.net
Tue May 14 19:29:01 CDT 2002


----- Original Message -----
From: "Ben Henick" <persist1 at io.com>
To: <thelist at lists.evolt.org>
Sent: Tuesday, May 14, 2002 5:01 PM
Subject: Re: [thelist] Javascript Help Needed


> On Tue, 14 May 2002, Locke wrote:
>
> > Here's the conundrum: I am making a website that uses pull-down menus
and
> > GIFs to make a multi-layered display of some map data. I have it working
> > quite well at the moment, but there is a minor problem. Due to my lack
of
> > experience in such ventures, I wrote the javascript in such a way that
it
> > preloads all the images (over 1 thousand). This is quite a bad thing to
do,
> > and a fo pas in my undrestanding.
>
> Argh.
>
> It sounds like - first and foremost - you need to put some more thought
> into the application design.

<nod> Thought good.

> If you're using JavaScript to swap out images (an implementation which
> poses a few problems for accessibility), just don't preload anything...

Eh? Is there another way you would suggest doing image swaps? I have some
background in C++ and javascript meshed well with my previous knowledge. If
there is a better way (by language) to do this, do enlighten me.

> The 'new Image()' statements can be made on the fly and the subsequent
> images dropped in the place of whatever .src is there at the time, though
> in this case you'll probably want to generate the object names randomly.

<nod> Problem is that I don't know another way to work this without doing it
the way I did. If I may impose some pseudo code -

<script>
array = new array(3 dimensional 10x5x4);
nested for statments to init array w/ new image();
long list of statments to fill array with images;
</script>

I suppose that I could dynamically fill the array on request ... tho, I
would have to check up on the parsing of parts to get this done.
Alternatively, and this is what I think you are suggesting, I could parse
and pop each image on request, thus avoiding the arrays in their entirety.

> For the most part, it boils down to how you write the function that sits
> behind the onclick event, or the HREF's for your wayfinding links.

<chuckle> The onClick function is about as simple as I can make it. It seems
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.

Hrmmmm, back to the drawing board.

http -- http://12.228.249.163/iere/
or, ftp -- ftp://friend:password@12.228.249.163:2112/iere-site

-Locke-




More information about the thelist mailing list