Help Me Modify Javascript

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Dennis M. Marks

    Help Me Modify Javascript

    I found a javascript that displays a clock that follows the mouse. I
    would like to not have it appear on the page until a link is clicked.
    It will disappear when another link is clicked. I tried making it a
    function and calling it but that does not work (and even if it did I
    don't know how to stop and clear it.).

    The page that displays the clock is


    The script is at http://www.dcs-chico.com/~denmarks/mouseclock.js

    --
    Dennis M. Marks


    -----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
    http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
    -----== Over 100,000 Newsgroups - 19 Different Servers! =-----
  • Lasse Reichstein Nielsen

    #2
    Re: Help Me Modify Javascript

    "Dennis M. Marks" <denmarks@dcsi. net> writes:
    [color=blue]
    > I found a javascript that displays a clock that follows the mouse.[/color]

    I was about to say that that was a horrible idea. I must say it looks
    cool, though. Still not something I would want on a normal web page.
    It is all about style, an not about telling the time, so save it for
    a high-style/low-content page.

    Checking the code, I can see that it will not work in Mozilla/Netscape
    6+, since it uses either document.layers or document.all, neither of
    which is available in Mozilla.
    [color=blue]
    > I would like to not have it appear on the page until a link is
    > clicked.[/color]

    The call that starts the clock is to the function "Delay". It is
    called when the page is loaded by the assignment:
    if (ns||ie)window. onload=Delay;
    You can call it yourself instead. Don't use a link though. Links
    are for linking to other pages. If you want something to click
    for an effect, use a button.
    <input type="button" value="start clock" onclick="Delay( )">
    and remove the onload assignment.
    [color=blue]
    > It will disappear when another link is clicked.[/color]

    This one is harder, since that functionality is not included.
    What you can do is move it off the screen. Set the variable
    clockFromMouseY to minus one million or so, thay should make
    sure the clock is not visible.

    <input type="button" value="start clock"
    onclick="ClockF romMouseY=0;if (!window.starte d) {Delay()}
    else {window.started =true};">
    <input type="button" value="stop clock" onclick="ClockF romMouseY=-1E6">

    You could add code to stop the timer too, if you think it is
    necessary, but that requires changing the code.

    /L
    --
    Lasse Reichstein Nielsen - lrn@hotpop.com
    DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
    'Faith without judgement merely degrades the spirit divine.'

    Comment

    • Dennis M. Marks

      #3
      Re: Help Me Modify Javascript

      I agree that it is a bad idea. It is just for fun. That is why I wanted
      to be able to start and stop it. This site is for my use and probably
      gets very few hits from the outside world.

      I'll try some of your ideas. BTW: I didn't mean link. I just used the
      wrong terminology.

      In article <llqh9jjz.fsf@h otpop.com>, Lasse Reichstein Nielsen
      <lrn@hotpop.com > wrote:
      [color=blue]
      > I was about to say that that was a horrible idea. I must say it looks
      > cool, though. Still not something I would want on a normal web page.
      > It is all about style, an not about telling the time, so save it for
      > a high-style/low-content page.[/color]

      --
      Dennis M. Marks


      -----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
      http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
      -----== Over 100,000 Newsgroups - 19 Different Servers! =-----

      Comment

      Working...