By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,286 Members | 1,673 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,286 IT Pros & Developers. It's quick & easy.

How to repeat this code

P: n/a
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
Jul 20 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
While the city slept, Lasse Reichstein Nielsen <lr*@hotpop.com> feverishly
typed:
"George C" <to*@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?


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. ni***@nigenetDOG.org.uk. Take the dog out!
http://www.nigenet.org.uk | Boycott E$$O!! http://www.stopesso.com
"They got the mustard out!"
Jul 20 '05 #2

P: n/a
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" <to*@tom.net> wrote in message
news:vg************@corp.supernews.com...
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

Jul 20 '05 #3

P: n/a
While the city slept, Stuart Palmer <tr**********@youcant.com> feverishly
typed:

[Top posting fixed]
"nice.guy.nige" <ni********@deadspam.com> wrote in message
news:bd************@ID-112325.news.dfncis.de...
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!

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


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. ni***@nigenetDOG.org.uk. Take the dog out!
http://www.nigenet.org.uk | Boycott E$$O!! http://www.stopesso.com
"They got the mustard out!"
Jul 20 '05 #4

P: n/a
Stuart, thank you for continuing to come up with a solution.
"Stuart Palmer" <tr**********@youcant.com> wrote in message
news:bd**********@sp15at20.hursley.ibm.com...
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 wanted to do and
repeat the scroll across the screen, it's just a different interpretation of the question, so all parties are correct here.

Stu

p.s I am looking into the solution.

"nice.guy.nige" <ni********@deadspam.com> wrote in message
news:bd************@ID-112325.news.dfncis.de...
While the city slept, Lasse Reichstein Nielsen <lr*@hotpop.com> feverishly typed:
"George C" <to*@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?


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. ni***@nigenetDOG.org.uk. Take the dog out!
http://www.nigenet.org.uk | Boycott E$$O!! http://www.stopesso.com
"They got the mustard out!"


---
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
Jul 20 '05 #5

P: n/a
Works beautifully. Thank you Stuart for the help and common sense approach.

G

"Stuart Palmer" <tr**********@youcant.com> wrote in message
news:sB***************@newsfep3-gui.server.ntli.net...
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" <to*@tom.net> wrote in message
news:vg************@corp.supernews.com...
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


---
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
Jul 20 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.