User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 425,895 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 1,932 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 599 | Replies: 2 | Solved
Reply
Join Date: May 2008
Location: Hyderabad, India
Posts: 261
Reputation: sreein1986 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 30
sreein1986's Avatar
sreein1986 sreein1986 is offline Offline
Posting Whiz in Training

Changing Images in HTML

  #1  
Jun 26th, 2008
Hi, everybody,
How to change the images after every 5 seconds in html??????
The images should display in the same places for every 5 seconds?????
can anybody send me code please....

i posted this thread in HTML forum somebody told me that post here so please help anybody

And Advanced thanks...
Thanx,
Sreekanth

www.saap.in
if you problem solved add me as a reputation and mark it mark as solved
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jun 2008
Location: Phoenix, AZ
Posts: 770
Reputation: R0bb0b is on a distinguished road 
Rep Power: 2
Solved Threads: 63
R0bb0b's Avatar
R0bb0b R0bb0b is online now Online
Master Poster

Re: Changing Images in HTML

  #2  
Jun 26th, 2008
This will give you the basic functionality:
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>Untitled Document</title>
  6. <script language="javascript" type="text/javascript">
  7. var timerid = 0;
  8. var images = new Array( "image1.jpg",
  9. "image2.jpg",
  10. "image3.jpg");
  11. var countimages = 0;
  12. function startTime()
  13. {
  14. if(timerid)
  15. {
  16. timerid = 0;
  17. }
  18. var tDate = new Date();
  19.  
  20. if(countimages == images.length)
  21. {
  22. countimages = 0;
  23. }
  24. if(tDate.getSeconds() % 5 == 0)
  25. {
  26. document.getElementById("img1").src = images[countimages];
  27. }
  28. countimages++;
  29.  
  30. timerid = setTimeout("startTime()", 1000);
  31. }
  32. </script>
  33. </head>
  34.  
  35. <body onload="startTime();">
  36. <img id="img1" src="image3.jpg" />
  37. </body>
  38. </html>
Last edited by R0bb0b : Jun 26th, 2008 at 5:34 am.
Reply With Quote  
Join Date: May 2008
Location: Hyderabad, India
Posts: 261
Reputation: sreein1986 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 30
sreein1986's Avatar
sreein1986 sreein1986 is offline Offline
Posting Whiz in Training

Re: Changing Images in HTML

  #3  
Jun 26th, 2008
Thanks very much i added your reputation
Thanx,
Sreekanth

www.saap.in
if you problem solved add me as a reputation and mark it mark as solved
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb JavaScript / DHTML / AJAX Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum

All times are GMT -4. The time now is 7:21 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC