Picture

G

GTi

On my page I have some links to ASP.NET generated pictures.
I use this
document.images.grapreportpic1.src = url2newimage
to display the report picture.

But the "problem" is that it may take some time to generate the
picture.

Is it possible (how) to first display a preloaded image and then switch
it to the new image?

function DisplayGrapPic(url2newimage)
{
document.images.grapreportpic1.src = preloadedImageVar;
document.images.grapreportpic1.src = url2newimage;
}
 
I

impaler

GTi said:
On my page I have some links to ASP.NET generated pictures.
I use this
document.images.grapreportpic1.src = url2newimage
to display the report picture.

But the "problem" is that it may take some time to generate the
picture.

Is it possible (how) to first display a preloaded image and then switch
it to the new image?

function DisplayGrapPic(url2newimage)
{
document.images.grapreportpic1.src = preloadedImageVar;
document.images.grapreportpic1.src = url2newimage;
}

try this but I typed it into the reply, wasn't checked for syntax
errors but it should work.

function DisplayGrapPic(url2newimage)
{
document.images.grapreportpic1.src = preloadedImageVar;
reportImg = new Image;
reportImg.src = url2newimage;
document.images.grapreportpic1 = reportImg;
}

you can create the reportImg outside the function and preload it on
onload but I presume you call DisplayGrapPic on the body's onload
event...so it should be fine
 
G

GTi

impaler said:
try this but I typed it into the reply, wasn't checked for syntax
errors but it should work.

function DisplayGrapPic(url2newimage)
{
document.images.grapreportpic1.src = preloadedImageVar;
reportImg = new Image;
reportImg.src = url2newimage;
document.images.grapreportpic1 = reportImg;
}
you can create the reportImg outside the function and preload it on
onload but I presume you call DisplayGrapPic on the body's onload
event...so it should be fine
Well, I don't use it in the body's onload
I have several links on my page that change the report picture on the
same document.
onclick=DisplayGrapPic('http://..../report.aspx?reportype=1')
(kvasir Ajax)

Thanks for the code, I will test it out.
 

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
473,780
Messages
2,569,611
Members
45,276
Latest member
Sawatmakal

Latest Threads

Top