469,360 Members | 1,728 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,360 developers. It's quick & easy.

Picture

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;
}

Jan 19 '06 #1
2 1076
GTi wrote:
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

Jan 19 '06 #2
GTi
impaler wrote:
GTi wrote:
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

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.

Jan 19 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

10 posts views Thread by Chris Coho, Jr. | last post: by
2 posts views Thread by Lyn | last post: by
6 posts views Thread by Jeff | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.