By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,605 Members | 2,153 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,605 IT Pros & Developers. It's quick & easy.

pre-loading images on the client browser

P: n/a
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

Sep 30 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
va*********@gmail.com wrote:
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.
--
Rob
Sep 30 '05 #2

P: n/a
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

Sep 30 '05 #3

P: n/a
va*********@gmail.com wrote:
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.

--
Rob
Sep 30 '05 #4

P: n/a
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.

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Sep 30 '05 #5

P: n/a
RobG wrote:
va*********@gmail.com wrote:
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).


ISTM you both want to read on ASP and NES basics.
PointedEars
--
Microsoft has been doing a really bad job on their OS. -- Linus Torvalds
Oct 16 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.