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

Picture

P: n/a
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
Share this Question
Share on Google+
2 Replies


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

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