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

Help Me Modify Javascript

P: n/a
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
http://www.dcs-chico.com/~denmarks/mouseclock.html

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! =-----
Jul 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
"Dennis M. Marks" <de******@dcsi.net> writes:
I found a javascript that displays a clock that follows the mouse.
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.
I would like to not have it appear on the page until a link is
clicked.
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.
It will disappear when another link is clicked.


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="ClockFromMouseY=0;if (!window.started) {Delay()}
else {window.started=true};">
<input type="button" value="stop clock" onclick="ClockFromMouseY=-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 - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #2

P: n/a
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 <ll**********@hotpop.com>, Lasse Reichstein Nielsen
<lr*@hotpop.com> wrote:
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.


--
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! =-----
Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.