Connecting Tech Pros Worldwide Help | Site Map

How to repeat this code

George C
Guest
 
Posts: n/a
#1: Jul 20 '05
How can I get this to repeat an infinite number of times?

Thanks

=================
</head>

<body onload="starttimer()" onunload="stoptimer()">

<script type="text/javascript">
var i=1
function starttimer()
{
myimage.style.position="relative"
myimage.style.left=+i
i++
timer=setTimeout("starttimer()",12)
}

function stoptimer()
{
clearTimeout(timer)
}
</script>


<p>

<img id="myimage" src="Images/housemove.gif" width="209" height="109"
loop="5" />


---
I Cor. 10:31
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.491 / Virus Database: 290 - Release Date: 6/22/2003


nice.guy.nige
Guest
 
Posts: n/a
#2: Jul 20 '05

re: How to repeat this code


While the city slept, Lasse Reichstein Nielsen <lrn@hotpop.com> feverishly
typed:
[color=blue]
> "George C" <tom@tom.net> writes:
>[color=green]
>> How can I get this to repeat an infinite number of times?[/color]
>
> It seems to work for me. What is the problem?[/color]

Considering the OP wants it to repeat to infinity, how can you possibly say
it works? ;-) Especially only a quarter of an hour after his post!

Cheers,
Nige

--
Nigel Moss.

Email address is not valid. nigel@nigenetDOG.org.uk. Take the dog out!
http://www.nigenet.org.uk | Boycott E$$O!! http://www.stopesso.com
"They got the mustard out!"


Stuart Palmer
Guest
 
Posts: n/a
#3: Jul 20 '05

re: How to repeat this code


try this, will only work in IE though. Don't know if it's the best way to do
it, but modified the code you already had.

<body onload="starttimer()">

<script type="text/javascript">
loc = -209
var ws = document.body.clientWidth;
function starttimer()
{
myimage.style.position="relative";
myimage.style.left=loc;
loc++;
if (loc > (ws))
{
loc = -209;
setTimeout("starttimer()",12)
}
else
{
setTimeout("starttimer()",12)
}
}
</script>


<p>

<img id="myimage" src="Images/housemove.gif" width="209" height="109"/>

Stu



"George C" <tom@tom.net> wrote in message
news:vg1rs07eb36oc5@corp.supernews.com...[color=blue]
> How can I get this to repeat an infinite number of times?
>
> Thanks
>
> =================
> </head>
>
> <body onload="starttimer()" onunload="stoptimer()">
>
> <script type="text/javascript">
> var i=1
> function starttimer()
> {
> myimage.style.position="relative"
> myimage.style.left=+i
> i++
> timer=setTimeout("starttimer()",12)
> }
>
> function stoptimer()
> {
> clearTimeout(timer)
> }
> </script>
>
>
> <p>
>
> <img id="myimage" src="Images/housemove.gif" width="209" height="109"
> loop="5" />
>
>
> ---
> I Cor. 10:31
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.491 / Virus Database: 290 - Release Date: 6/22/2003
>
>[/color]


nice.guy.nige
Guest
 
Posts: n/a
#4: Jul 20 '05

re: How to repeat this code


While the city slept, Stuart Palmer <tryandspamme@youcant.com> feverishly
typed:

[Top posting fixed]
[color=blue]
> "nice.guy.nige" <nigel_moss@deadspam.com> wrote in message
> news:bdrlc6$tj2c8$1@ID-112325.news.dfncis.de...[color=green]
>> Considering the OP wants it to repeat to infinity, how can you
>> possibly say it works? ;-) Especially only a quarter of an hour
>> after his post![/color]
> what he means is for the code that is written, it does work, it will
> continue to move the image to the right indefinatly thus repeating
> the move. He did not state what most of us assumed the the poster[/color]

I think you missed the humour in my post.

On a more serious note, please post according to the group's style, as can
be found in the FAQ's (posted to the group yesterday and available online at
http://www.jibbering.com/faq/).

Cheers,
Nige

--
Nigel Moss.

Email address is not valid. nigel@nigenetDOG.org.uk. Take the dog out!
http://www.nigenet.org.uk | Boycott E$$O!! http://www.stopesso.com
"They got the mustard out!"


George C
Guest
 
Posts: n/a
#5: Jul 20 '05

re: How to repeat this code


Stuart, thank you for continuing to come up with a solution.


"Stuart Palmer" <tryandspamme@youcant.com> wrote in message
news:bds8gf$65i$1@sp15at20.hursley.ibm.com...[color=blue]
> what he means is for the code that is written, it does work, it will
> continue to move the image to the right indefinatly thus repeating the[/color]
move.[color=blue]
> He did not state what most of us assumed the the poster wanted to do and
> repeat the scroll across the screen, it's just a different interpretation[/color]
of[color=blue]
> the question, so all parties are correct here.
>
> Stu
>
> p.s I am looking into the solution.
>
> "nice.guy.nige" <nigel_moss@deadspam.com> wrote in message
> news:bdrlc6$tj2c8$1@ID-112325.news.dfncis.de...[color=green]
> > While the city slept, Lasse Reichstein Nielsen <lrn@hotpop.com>[/color][/color]
feverishly[color=blue][color=green]
> > typed:
> >[color=darkred]
> > > "George C" <tom@tom.net> writes:
> > >
> > >> How can I get this to repeat an infinite number of times?
> > >
> > > It seems to work for me. What is the problem?[/color]
> >
> > Considering the OP wants it to repeat to infinity, how can you possibly[/color]
> say[color=green]
> > it works? ;-) Especially only a quarter of an hour after his post!
> >
> > Cheers,
> > Nige
> >
> > --
> > Nigel Moss.
> >
> > Email address is not valid. nigel@nigenetDOG.org.uk. Take the dog out!
> > http://www.nigenet.org.uk | Boycott E$$O!! http://www.stopesso.com
> > "They got the mustard out!"
> >
> >[/color]
>
>[/color]


---
I Cor. 10:31
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.491 / Virus Database: 290 - Release Date: 6/23/2003




---
I Cor. 10:31
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.491 / Virus Database: 290 - Release Date: 6/23/2003


George C
Guest
 
Posts: n/a
#6: Jul 20 '05

re: How to repeat this code


Works beautifully. Thank you Stuart for the help and common sense approach.

G

"Stuart Palmer" <tryandspamme@youcant.com> wrote in message
news:sBiMa.761$Fz3.734@newsfep3-gui.server.ntli.net...[color=blue]
> try this, will only work in IE though. Don't know if it's the best way to[/color]
do[color=blue]
> it, but modified the code you already had.
>
> <body onload="starttimer()">
>
> <script type="text/javascript">
> loc = -209
> var ws = document.body.clientWidth;
> function starttimer()
> {
> myimage.style.position="relative";
> myimage.style.left=loc;
> loc++;
> if (loc > (ws))
> {
> loc = -209;
> setTimeout("starttimer()",12)
> }
> else
> {
> setTimeout("starttimer()",12)
> }
> }
> </script>
>
>
> <p>
>
> <img id="myimage" src="Images/housemove.gif" width="209" height="109"/>
>
> Stu
>
>
>
> "George C" <tom@tom.net> wrote in message
> news:vg1rs07eb36oc5@corp.supernews.com...[color=green]
> > How can I get this to repeat an infinite number of times?
> >
> > Thanks
> >
> > =================
> > </head>
> >
> > <body onload="starttimer()" onunload="stoptimer()">
> >
> > <script type="text/javascript">
> > var i=1
> > function starttimer()
> > {
> > myimage.style.position="relative"
> > myimage.style.left=+i
> > i++
> > timer=setTimeout("starttimer()",12)
> > }
> >
> > function stoptimer()
> > {
> > clearTimeout(timer)
> > }
> > </script>
> >
> >
> > <p>
> >
> > <img id="myimage" src="Images/housemove.gif" width="209" height="109"
> > loop="5" />
> >
> >
> > ---
> > I Cor. 10:31
> > Outgoing mail is certified Virus Free.
> > Checked by AVG anti-virus system (http://www.grisoft.com).
> > Version: 6.0.491 / Virus Database: 290 - Release Date: 6/22/2003
> >
> >[/color]
>
>[/color]


---
I Cor. 10:31
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.491 / Virus Database: 290 - Release Date: 6/24/2003




---
I Cor. 10:31
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.491 / Virus Database: 290 - Release Date: 6/24/2003


Closed Thread


Similar JavaScript / Ajax / DHTML bytes