PDA

View Full Version : javascript set interval



Nirupamavinoth2
04-03-2012, 02:33 AM
Hi All,

I have three swfs and i need to load them one by one with time interval inside div and this is my code.


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>SWFObject</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<script type="text/javascript" src="swfobject.js"></script>
<script lang="javascript" type="text/javascript">
var swfObjs=['loadtext.swf','intro_page.swf','welcome.swf'];
var counter=0;
var timer = 12;
function nextSwf()
{
if (counter == swfObjs.length-1)
{
counter = 0;
}
else
{
counter++;
}
swfobject.embedSWF(swfObjs[counter], "movieContainer", "300", "120", "9.0.0", "100",(timer));
}

</script>
</head>
<body onload='nextSwf();'>


<div id="movieContainer"


</div>

</body>
</html>
pls help.... on how to set the interval for loading the swfs with time gap.

Thanks in advance

keyboard
04-03-2012, 09:17 AM
Check out this (http://www.w3schools.com/jsref/met_win_settimeout.asp) site.

Hope it helps
Keyboard1333