Flash Games
 FAQ   Search   Memberlist   Usergroups   Register  Profile   Log in to check your private messages   Log in 


Switch Divs



 

Post new topic   Reply to topic  
   DEVPPL Forum Index -> Script-archive
View previous topic :: View next topic  
Author Message
rangana
500+ Club


Joined: 27 Feb 2008
Posts: 614
Location: Cebu City Philippines

PostPosted: Wed Apr 23, 2008 6:31 am    Post subject: Switch Divs Reply with quote

Can we switch from one divs to another divs automatically?.. Rolling Eyes

...With JS, this could be possible, see this script Smile

Code:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
   "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
#wrap{width:304px;margin:20px auto;border:3px double #555;padding:10px;font-family:Arial;font-size:10pt;}
.mydiv{
width:300px;
height:200px;
border:1px solid #000000;
text-align:center;
}
#one{background:#eee;}
#two{background:#fc0;}
#three{background:#9c0;color:#222;}
#four{background:#96c;color:#fff;}
.show{
display:block;
}
.hidden{
display:none
}
</style>
<script type="text/javascript">
function rangSwitch(rang,pause)
{
var divs=document.getElementById('wrap').getElementsByTagName('div');
var iterate=0, obj;
while(obj=divs[iterate++])
{obj.style.display='none';}

divs[rang].style.display='block';
rang++;
rang==divs.length?rang=0:null;

setTimeout(function(){rangSwitch(rang,pause)},pause);
}
window.onload=function()
{
var pause=2000; //computer per miliseconds
setTimeout(function(){rangSwitch(1,pause)},pause);
}
</script>
</head>
<body>
<div id="wrap">
<div class="mydiv show" id="one"> First Div </div>
<div class="mydiv hidden" id="two"> Second Div </div>
<div class="mydiv hidden" id="three"> Third Div </div>
<div class="mydiv hidden" id="four"> Fourth Div </div>
</div>
</body>
</html>
Back to top
View user's profile Send private message Yahoo Messenger
DDragon
50+ Club


Joined: 20 Jun 2007
Posts: 90
Location: Australia

PostPosted: Sat Aug 23, 2008 10:03 am    Post subject: Re: Switch Divs Reply with quote

This has a wide range of applications Smile great work.

DD
Back to top
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger MSN Messenger
rangana
500+ Club


Joined: 27 Feb 2008
Posts: 614
Location: Cebu City Philippines

PostPosted: Sat Aug 23, 2008 10:39 am    Post subject: Re: Switch Divs Reply with quote

Thank you.
Back to top
View user's profile Send private message Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic    DEVPPL Forum Index -> Script-archive All times are GMT + 1 Hour
Page 1 of 1

 
 
Welcome to DEVPPL.com
You are not logged in, which means that you can't post in the forums.
Click here to Register

If you are a current member here on DEVPPL, please login below:

User: Pass:
Log me on automatically each visit:

 


Powered by phpBB © 2001, 2005 phpBB Group - Modified by DEVPPL

Flash Games - Sitemap