pre-loading images on the client browser

V

vanisathish

Hi
I have an application, which has to change to different images based on
some conditions. I am trying to call a javascript function(this
function changes the images on the front end) from the ASP script. I
want to preload all the images to the client side browser and point to
a different image source through the javascript.how do i do this in
javascript. any pointers appreciated


THanks
 
R

RobG

Hi
I have an application, which has to change to different images based on
some conditions. I am trying to call a javascript function(this
function changes the images on the front end) from the ASP script. I
want to preload all the images to the client side browser and point to
a different image source through the javascript.how do i do this in
javascript. any pointers appreciated

Preloading images:
Search this group for 'preload images'. About 1,700 results are
returned. Sort by date and go from there...

Changing image src attribute:
Search this group for 'change image'. About 9,660 results are returned.
Sort by date and go from there... (some cover preloading too).

Use the above searches to get something working. Once it is close to
what you want but doesn't quite work, come back.
 
V

vanisathish

Hi,
I am able to preload the image and change the image on the client side.
But my requirement is i need to change this image from the server side
ie. from an ASP. is there any way to call client side javascript
functions/javascript variables from the ASP so that i can point
directly to the global array containing the preloaded images from the
javascript.

response.write "parent.content.ACUEq1.src = gsatimgarray[1].src ;"

where gsatimgarray is the array holding all the images on the client
side. Is there a way to update these images through javascript.
The above line doesnt seem to work
 
R

RobG

Hi,
I am able to preload the image and change the image on the client side.
But my requirement is i need to change this image from the server side
ie. from an ASP. is there any way to call client side javascript
functions/javascript variables from the ASP so that i can point
directly to the global array containing the preloaded images from the
javascript.

Seems you are in the wrong forum. JavaScript is almost exclusively a
client-side technology, and must be considered an extremely unreliable
one in terms of robust client-server application development (that is
not to say it can't be done in a well controlled environment, but there
are probably more suitable technologies).
response.write "parent.content.ACUEq1.src = gsatimgarray[1].src ;"

where gsatimgarray is the array holding all the images on the client
side. Is there a way to update these images through javascript.
The above line doesnt seem to work

What you are attempting is to 'push' data to the client. Such
architectures have been spectacularly unsuccessful on the web - though
they were all the rage for a while around 1996 or 1997.

Pushing data is against a fundamental premise of the web which is that
the client decides when it will get data from the server: the server has
no power at all to force a client to do anything.

You many include instructions in a page (e.g. using script or other
elements) that suggest that the client request information from the
server from time to time or when a user performs some action. The
client might (or might not) take notice of these suggestions.
 
E

Evertjan.

wrote on 30 sep 2005 in comp.lang.javascript:
Hi,
I am able to preload the image and change the image on the client side.
But my requirement is i need to change this image from the server side
ie. from an ASP. is there any way to call client side javascript
functions/javascript variables from the ASP so that i can point
directly to the global array containing the preloaded images from the
javascript.

response.write "parent.content.ACUEq1.src = gsatimgarray[1].src ;"

where gsatimgarray is the array holding all the images on the client
side. Is there a way to update these images through javascript.

There is no ASP language!

Javasipt is not equivalent with clientside.

==========

So this is serverside javascript
containing a piece of clientside javascript::

response.write("parent.content.ACUEq1.src = gsatimgarray[1].src ;");

And this is serverside VBscript
containing a piece of clientside javascript::

response.write "parent.content.ACUEq1.src = gsatimgarray[1].src ;"

The serverside script renders/generates an clientside html that can
contain cclientside script, in javascript or any other language that the
browser can execute.

The serverside script is finished, when this resulting html is sent to
the client, so changing the ready clientside script by serverside script
is not possible.

============
The above line doesnt seem to work

The following are equivalent:

response.write "parent.content.ACUEq1.src = gsatimgarray[1].src ;"

and

%>
parent.content.ACUEq1.src = gsatimgarray[1].src ;
<%

So if the first is "Not working" [whatever that meant, you would have to
elaborate, showing error messages] the second is also "Not working"

So it must be a clientside problem.

Reducing the problem [for debugging reasons] to the html rendered [you
can get this by extracting it with viewsource on IE]
then you can set debugginf "breakpoints" like
alert(parent.content.ACUEq1.src);
and, if not successful, showing the html source to us [please only the
essentials], preferably as a link.

Then we can help.
 
T

Thomas 'PointedEars' Lahn

RobG said:
Seems you are in the wrong forum. JavaScript is almost exclusively a
client-side technology, and must be considered an extremely unreliable
one in terms of robust client-server application development (that is
not to say it can't be done in a well controlled environment, but there
are probably more suitable technologies).

ISTM you both want to read on ASP and NES basics.


PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,432
Messages
2,571,681
Members
48,796
Latest member
Greg L.

Latest Threads

Top