How to repeat this code

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • George C

    How to repeat this code

    How can I get this to repeat an infinite number of times?

    Thanks

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

    <body onload="startti mer()" onunload="stopt imer()">

    <script type="text/javascript">
    var i=1
    function starttimer()
    {
    myimage.style.p osition="relati ve"
    myimage.style.l eft=+i
    i++
    timer=setTimeou t("starttimer() ",12)
    }

    function stoptimer()
    {
    clearTimeout(ti mer)
    }
    </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

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


    Comment

    • Stuart Palmer

      #3
      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="startti mer()">

      <script type="text/javascript">
      loc = -209
      var ws = document.body.c lientWidth;
      function starttimer()
      {
      myimage.style.p osition="relati ve";
      myimage.style.l eft=loc;
      loc++;
      if (loc > (ws))
      {
      loc = -209;
      setTimeout("sta rttimer()",12)
      }
      else
      {
      setTimeout("sta rttimer()",12)
      }
      }
      </script>


      <p>

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

      Stu



      "George C" <tom@tom.net> wrote in message
      news:vg1rs07eb3 6oc5@corp.super news.com...[color=blue]
      > How can I get this to repeat an infinite number of times?
      >
      > Thanks
      >
      > =============== ==
      > </head>
      >
      > <body onload="startti mer()" onunload="stopt imer()">
      >
      > <script type="text/javascript">
      > var i=1
      > function starttimer()
      > {
      > myimage.style.p osition="relati ve"
      > myimage.style.l eft=+i
      > i++
      > timer=setTimeou t("starttimer() ",12)
      > }
      >
      > function stoptimer()
      > {
      > clearTimeout(ti mer)
      > }
      > </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]


      Comment

      • nice.guy.nige

        #4
        Re: How to repeat this code

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

        [Top posting fixed]
        [color=blue]
        > "nice.guy.n ige" <nigel_moss@dea dspam.com> wrote in message
        > news:bdrlc6$tj2 c8$1@ID-112325.news.dfn cis.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@nigenetDO G.org.uk. Take the dog out!
        http://www.nigenet.org.uk | Boycott E$$O!! http://www.stopesso.com
        "They got the mustard out!"


        Comment

        • George C

          #5
          Re: How to repeat this code

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


          "Stuart Palmer" <tryandspamme@y oucant.com> wrote in message
          news:bds8gf$65i $1@sp15at20.hur sley.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.n ige" <nigel_moss@dea dspam.com> wrote in message
          > news:bdrlc6$tj2 c8$1@ID-112325.news.dfn cis.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@nigenetDO G.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


          Comment

          • George C

            #6
            Re: How to repeat this code

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

            G

            "Stuart Palmer" <tryandspamme@y oucant.com> wrote in message
            news:sBiMa.761$ Fz3.734@newsfep 3-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="startti mer()">
            >
            > <script type="text/javascript">
            > loc = -209
            > var ws = document.body.c lientWidth;
            > function starttimer()
            > {
            > myimage.style.p osition="relati ve";
            > myimage.style.l eft=loc;
            > loc++;
            > if (loc > (ws))
            > {
            > loc = -209;
            > setTimeout("sta rttimer()",12)
            > }
            > else
            > {
            > setTimeout("sta rttimer()",12)
            > }
            > }
            > </script>
            >
            >
            > <p>
            >
            > <img id="myimage" src="Images/housemove.gif" width="209" height="109"/>
            >
            > Stu
            >
            >
            >
            > "George C" <tom@tom.net> wrote in message
            > news:vg1rs07eb3 6oc5@corp.super news.com...[color=green]
            > > How can I get this to repeat an infinite number of times?
            > >
            > > Thanks
            > >
            > > =============== ==
            > > </head>
            > >
            > > <body onload="startti mer()" onunload="stopt imer()">
            > >
            > > <script type="text/javascript">
            > > var i=1
            > > function starttimer()
            > > {
            > > myimage.style.p osition="relati ve"
            > > myimage.style.l eft=+i
            > > i++
            > > timer=setTimeou t("starttimer() ",12)
            > > }
            > >
            > > function stoptimer()
            > > {
            > > clearTimeout(ti mer)
            > > }
            > > </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


            Comment

            Working...