Jump to content

code is running but images are not changing


Pawan_Agarwal

Recommended Posts

Javascript CODE:

var m=n=0;

function show_services()
{
m=m+1;
n=m+1;
if(m==6) {m=6;n=1;}
if(m==7) {m=1;n=2;}

str1 = "/images/pic" + m + ".PNG";
str2 = "/images/pic" + n + ".PNG";

document.getElementById('w1').innerHTML = str1;
document.getElementById('w2').innerHTML = str2;

document.getElementById('img1').src = str1;
document.getElementById('img2').src = str2;
}    

var my_str = setInterval(function() {show_services()},1000);

##############################################################################

 

<img id="img1" src="/images/pic1.PNG" style="margin-top:30px" height="100px" width="550px"/><br>
<img id="img2" src="/images/pic2.PNG" style="margin-top:30px" height="100px" width="550px"/><br>
 
<br>
<div id='w1'></div>
<br>
<div id='w2'></div>

##############################################################################

 

the code is working fine, files have been placed at the right place, str1 and str2 are getting correct values and they are updating at the right time..............I run same code on browser and it works fine, but, when I run the same code on website domain, it does work at all, what can be the reason for this ............

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.