0

In my application, I have a Javascript function which get called after every minute. This javascript function returns me new comma seprated string each time which contains image path and image name. I simply split this string and set the Image path to image and text to lable. Goel is to achive effect like image slide show.

Every thing works fine. The Images and name get change successfully on mizilla. When I browse this in IE the image and name not change at one time. Name get change first and then Image get changed. It was loosing the slide show effect.

I don't know why this is happening. Is it because of browse..? I need to change both Image and name at a time.

Can anyone tell me how to do it...?

Here is the sample javascript function I use to set the Image

function setImage(response)

 {

if(response.value != null)

{

var imgArr=response.value.split(',');

var SN=document.getElementById('ctl00_MC_cntrlGal_ScreenName');

var mainImage=document.getElementById("Img");

if(SN!=null && Img!=null)

{

SN.innerHTML=imgArr[0];

mainImage.src=imgArr[1];


}

}

}
4
  • 1
    a sample of your current code would be helpfull Commented Sep 24, 2009 at 7:34
  • Posting the relevant code would be nice if you want an accurate answer... Commented Sep 24, 2009 at 7:34
  • It's difficult to get relevant answer without code in this case, but I'll try. I think problem in set attribute code, because there are different way to set attribute in msie. But also there are may be many other problems with msie. Commented Sep 24, 2009 at 7:55
  • function setImage(response) { if(response.value != null) { var imgArr=response.value.split(','); var SN=document.getElementById('ctl00_MC_cntrlGal_ScreenName'); var mainImage=document.getElementById("Img"); if(SN!=null && Img!=null) { SN.innerHTML=imgArr[0]; mainImage.src=imgArr[1]; } } } Commented Sep 24, 2009 at 8:48

2 Answers 2

1

Himadri is right, problem is on image loading. But instead of setTimeout i recommend to use image preloading and load event as signal to change image. Your images have different size and users have different channels, so you can't be sure that image will be loaded in time.

Sign up to request clarification or add additional context in comments.

Comments

0

I think the problem is on image loading. Each time a new image path is set the browser takes time to load the image. As you know Images are heavy to load than text so the text is assigned fast and the image is being loaded slowly.

You can use setTimeOut and pause for some miliseconds and then set the text. I think it can solve your problem.

Please check.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.