HTML Tutorial


 /help/HTML Help Forum   FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
RegisterRegister - Not registered yet? Got something to say? Join HTML Code Tutorial!
Refresh one image only
Post new topic   Reply to topic    HTML Help Forum -> General HTML
View previous topic :: View next topic  
Author Message
jimroberth



Joined: 18 Sep 2004
Posts: 4

PostPosted: Sat Sep 18, 2004 9:43 am     Refresh one image only Reply with quote

I want to refresh only the main image on a motion jpeg page not the whole page. Any ideas.

Thanks
mjpliv



Joined: 11 May 2004
Posts: 402
Location: Nova Scotia

PostPosted: Mon Sep 20, 2004 5:51 am     Reply with quote

Code:
<!-- Code Begin -->
      
      <IMG src="image_name.jpg" width="275" height="200" border="1" name="refresh">
      <SCRIPT language="JavaScript" type="text/javascript">
      <!--
      var t = 120 // interval in seconds
      image = "image_name.jpg" //name of the image
      function Start() {
      tmp = new Date();
      tmp = "?"+tmp.getTime()
      document.images["refresh"].src = image+tmp
      setTimeout("Start()", t*1000)
      }
      Start();
      // -->
      </SCRIPT>
      <!-- Code End -->


Try this one - I use it to refresh my webcam pics. Just insert your on image address and interval time
jimroberth



Joined: 18 Sep 2004
Posts: 4

PostPosted: Mon Sep 20, 2004 6:48 pm     Great Reply with quote

Just what I wanted. Thanks, I owe you a beer.

Jim H
orbital



Joined: 11 Oct 2004
Posts: 8

PostPosted: Mon Oct 11, 2004 10:55 pm     Reply with quote

would this work with a random background image reloaded at a specific interval?


thanks in advance....just joined having a good look around Very Happy
mjpliv



Joined: 11 May 2004
Posts: 402
Location: Nova Scotia

PostPosted: Tue Oct 12, 2004 3:12 am     Reply with quote

One of our websites uses this script to generate a random top banner image.

This is the site

http://www.crescohomes.com


Here is the script in the HEAD portion


Code:
<SCRIPT LANGUAGE=JavaScript><!-- Hide this script from old browsers --


var imagenumber = 7 ;

var randomnumber = Math.random() ;

var rand1 = Math.round( (imagenumber-1) * randomnumber) + 1 ;

images = new Array

images[1] = "banner1.jpg"
images[2] = "banner2.jpg"
images[3] = "banner3.jpg"
images[4] = "banner4.jpg"
images[5] = "banner5.jpg"
images[6] = "banner6.jpg"
images[7] = "banner7.jpg"
var image = images[rand1]


// -- End Hiding Here --></SCRIPT>
<SCRIPT LANGUAGE=JavaScript><!-- Hide this script from old browsers --


var imagenumber = 5 ;

var randomnumber = Math.random() ;

var rand2 = Math.round( (imagenumber-1) * randomnumber) + 1 ;

images = new Array

images[1] = "frontpic1.jpg"
images[2] = "frontpic2.jpg"
images[3] = "frontpic3.jpg"
images[4] = "frontpic4.jpg"
images[5] = "frontpic5.jpg"
var image2 = images[rand2]


// -- End Hiding Here --></SCRIPT>



This code is the BODY portion


Code:
<BODY BGCOLOR="#DBDFD4" marginheight=0 topmargin=0 marginwidth=0 leftmargin=0>
<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=621 HEIGHT=77 align="center">
  <tr>
      <td><img src="topbanner.gif" width="620" height="27" align="top" alt="Top Banner"></td>
    </tr>
   <TR>
      <TD VALIGN=top>
         <P><IMG SRC="toplogo.gif" ALT="Cresco Homes" WIDTH=189 HEIGHT=77 ALIGN=top><SCRIPT LANGUAGE=JavaScript><!-- Hide this script from old browsers --
document.write('<IMG SRC="' + image + '" width=431 height=77 align=top>')
// -- End Hiding Here --></SCRIPT>
      </TD>
   </TR>


Perhaps the "' + image + '" can be placed in the BODY tag for the background image. Play with it and see what happens.
orbital



Joined: 11 Oct 2004
Posts: 8

PostPosted: Tue Oct 12, 2004 1:48 pm     Reply with quote

thanks mjpliv

i'll work on that later on tonight, and report back how it goes

appreciate your help

orb
mjpliv



Joined: 11 May 2004
Posts: 402
Location: Nova Scotia

PostPosted: Tue Oct 12, 2004 3:04 pm     Reply with quote

I have no idea if it will work - Java is not a strong point for me.
Digi Spy



Joined: 28 Dec 2004
Posts: 1

PostPosted: Tue Dec 28, 2004 2:22 pm     Reply with quote

Hi, I'm new around here, so please excuse me if this had already been asked somewhere..

Is there a way, possibly using the code provided in this topic to refresh a single remotely-hosted (webcam) image with another remotely-hosted (webcam) image (different URL) on the same webpage after a few seconds delay without having to use a META refresh command to auto-load a new page, and a new image, I would also (if possible) like with a small caption above the image (which also changes with the image)?

Any and all help gratefully received.
wade_emc



Joined: 25 Feb 2010
Posts: 1

PostPosted: Thu Feb 25, 2010 12:59 pm     Reply with quote

Digi Spy,
yes it will work. You have to make all the variable names different, including the name of the function. But don't change the names of the built-in functions: i.e. Date()

I have this on one of my webpages
sticks464



Joined: 31 Dec 2006
Posts: 2631

PostPosted: Thu Feb 25, 2010 2:15 pm     Reply with quote

A little late wade_emc
That post is a little old (Dec 28, 2004).
Display posts from previous:   
Post new topic   Reply to topic    HTML Help Forum -> General HTML All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
HTML Help Archive
Powered by phpBB © 2001, 2005 phpBB Group
HTML Help topic RSS feed 

 
DARFUR
HOSTING / DESIGN
MAKE MONEY

Home
  |   Tutorials   |   Forum   |   Quick List   |   Link Directory   |   About
Copyright ©1997-2002 Idocs and ©2002-2007 HTML Code Tutorial