javascript - can i change image and swf file in js? -


i want change image after seconds.

i have code works fine images:

<script language="javascript">     var x = 0,         images = [         "images/product/8f0165121827ee27e9ae4645988e3742.png",         "images/product/f227c25f3cc58ab2af04a5da27879f17.png"     ];      setinterval(function() {         document.getelementbyid('ad').src = images[x];         if (x<1) {             x+=1;         } else if (x=2) {             x=0;         }     }, 1000); </script> <img id='ad' type='text' src="images/product/8f0165121827ee27e9ae4645988e3742.png" /> 

the problem have 1 image , 1 swf file.

can change code change image , swf file @ specific time?

to incorporate swf file, best bet use swfobject. simple open-source javascript library easy-to-use , standards-friendly method embed flash content. place in body of html code:

<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> <script type="text/javascript" src="swfobject.js"></script>  <script type="text/javascript">     images = new array;     images[0] = "images/product/8f0165121827ee27e9ae4645988e3742.png";     images[1] = "images/product/f227c25f3cc58ab2af04a5da27879f17.png";      setinterval(function() {changeimage()},1000);     x = 0;     function changeimage() {         if (x<2) {             document.getelementbyid('ad').src = images[x];             x+=1;         }         else if (x == 2) {             swfobject.embedswf("mycontent.swf", "mycontent", "300", "120", "9.0.0");             x+=1;         }         else {             x=0;         }     } </script> <img id='ad' type='text' src="images/product/8f0165121827ee27e9ae4645988e3742.png" /> 

with mycontent.swf being name of swf file want add. tool use along swfobject html , javascript generator. generates html , javascript need embed flash using swfobject.


Comments