|
|
docilebob
Maniac (V) Mad Scientist
From: buttcrack of the midwest Insane since: Oct 2000
|
posted 04-03-2002 03:58
Can someone explain ( with small words and crayons, where possible) the javascript timeout function ?
Let`s say , for instance, you have a mouseover image you want to display, and then go away whether the mouse moves out, or not.
Also, is it possible to prevent the cursor change on a hot spot ?
|
lallous
Paranoid (IV) Inmate
From: Lebanon Insane since: May 2001
|
posted 04-03-2002 06:06
bob, setTimeout is just a function that evaluates expression after a number of milliseconds.
<script>
//this will say hello world in 5 secs
timeoutref = setTimeOut("alert('hello world')", 5000)
</script>
hotspot = image map/<area> ?
|
silence
Maniac (V) Inmate
From: soon to be "the land down under" Insane since: Jan 2001
|
posted 04-03-2002 21:37
So all you need to do would be to create a function for the mouseover event, and include a setTimeout(remove_rollover(),500) line with however long you want the image to stay before switching.
As for not having the cursor change over hotspots, the closing thing I can think of is briggl's hidden links tut over at Gurus.
Or flash.
[edit]
Heh, forgot about pugzly's cursor tut. You might find what you're looking for there
[This message has been edited by silence (edited 04-03-2002).]
|
Slime
Lunatic (VI) Mad Scientist
From: Massachusetts, USA Insane since: Mar 2000
|
posted 04-03-2002 22:09
Too keep the cursor from changing over a link, put cursor:default; in the style sheet for the anchor element with the link.
|
docilebob
Maniac (V) Mad Scientist
From: buttcrack of the midwest Insane since: Oct 2000
|
posted 04-04-2002 03:10
Thanks.
Being nearly js illiterate, I`ll go play with it, and let you know if I can make it work.
|
docilebob
Maniac (V) Mad Scientist
From: buttcrack of the midwest Insane since: Oct 2000
|
posted 04-11-2002 06:36
Ok, I played , I fiddled, I don`t get it.
I`m obviously missing something simple. Max keeps giving me a *does not support this action* message.
<edit> may just be my typing </edit>
test page
[This message has been edited by docilebob (edited 04-11-2002).]
|
Hew
Neurotic (0) Inmate Newly admitted
|
posted 04-11-2002 10:43
You have:
setTimeout = ("remove_rollover()",750);
it should be :
setTimeout("remove_rollover()",1000);
(setTimeout() is a function)
or
someVariable = setTimeout("remove_rollover()",1000);
the only reason I know of for assigning the function to a variable is so you can cancel it, with:
clearTimeout(someVariable);
this is more usefull with:
someVariable = setInterval("myFunction()",2000);
this repeats myFunction() every 2 seconds, until someVariable is cleared.
|
Hew
Neurotic (0) Inmate Newly admitted
|
posted 04-11-2002 10:52
|
docilebob
Maniac (V) Mad Scientist
From: buttcrack of the midwest Insane since: Oct 2000
|
posted 04-12-2002 01:47
Yes, hew the pastels will be fine. But too many colors at once will just confuse me again.
Also, changing the timeout line as you suggested moves the error message to *line 1 char1 object expected.*
I can`t seem to log on to my server, just now, so I haven`t updated the test page online, but that`s what` it`s telling me here.
|
Hew
Neurotic (0) Inmate Newly admitted
|
posted 04-14-2002 13:44
Thats becuase in the line:
setTimeout("remove_rollover()",750);
there is no function called
remover_rollover()
so did you want to turn it off again ?
this should do it:
setTimeout("imgOff('"+imgName+"')",750);
take care with the quotation marks .. there all needed.
|
docilebob
Maniac (V) Mad Scientist
From: buttcrack of the midwest Insane since: Oct 2000
|
posted 04-14-2002 21:35
Sorry, Hew. I`m kinda stupid, but I`m still missing something. With the setTimeout line changed as suggested, the rollover doesn`t work at all.
Also, not sure what you mean by * so did you want to turn it off again ?* Turn what off again ? the function or the image ?
All I want it to do is display the rollover and then revert to the original image..
In the end, I want to apply this to a multiple rollover image of clouds, like lightning flashes.
|
Hew
Neurotic (0) Inmate Newly admitted
|
posted 04-15-2002 20:21
When I said turn it off again , I meant to turn the image "off" again, seeing as though your function was called imgOff or something.
I made those changes before replying to see if it worked , and it did. Once the mouse was over the image, it changed until 0.75 of a second.
This worked for me:
<HTML>
<HEAD>
<TITLE>Time Out Test</TITLE>
<META NAME="GENERATOR" CONTENT="MAX's HTML Beauty++ ME">
<script language="javascript">
<!--
if (document.images) { // Active Images
img1on = new Image();
img1on.src = "testO.gif";
img1off = new Image();
img1off.src = "test.gif";
}
function imgOn(imgName) {
if (document.images) {
document[imgName].src = eval(imgName + "on.src");
setTimeout("imgOff('"+imgName+"')",750);
}
}
function imgOff(imgName) {
if (document.images) {
document[imgName].src = eval(imgName + "off.src");
}
}
</script>
</HEAD>
<BODY bgcolor="#999999">
<TABLE BORDER="1" width="50" height="50" ALIGN="center" CELLSPACING="0" CELLPADDING="0">
<TR>
<TD> <A HREF="#" onMouseOver="imgOn('img1')" onMouseOut="imgOff('img1')">
<IMG NAME="img1" SRC="test.gif" ALT="HOME" HEIGHT="50"
WIDTH="50" VSPACE="0" HSPACE="0" BORDER="0"></A></TD>
</TR>
</TABLE>
</BODY>
</HTML>
|
docilebob
Maniac (V) Mad Scientist
From: buttcrack of the midwest Insane since: Oct 2000
|
posted 04-16-2002 01:39
thanks, Hew, for the extra effort. I talked it over with a friend on ICQ, and got it worked out.
His solution was a bit different than yours, but I think I got it now. All`s well that times out well.
I`ll post the page so you can see it work, when I get it done. Little short on time, may take a day or two.
Thanks again.
|
docilebob
Maniac (V) Mad Scientist
From: buttcrack of the midwest Insane since: Oct 2000
|
posted 04-17-2002 03:52
Here`s the beta version.
still playing with it, but this is where I was headed.
Thanks.
<edit> Stupid fingers</edit>
[This message has been edited by docilebob (edited 04-17-2002).]
|
DocOzone
Maniac (V) Lord Mad Scientist Sovereign of all the lands Ozone and just beyond that little green line over there...
From: Stockholm, Sweden Insane since: Mar 1994
|
posted 04-17-2002 09:23
Coolness, the flashes feel really "real" now, cool! What next for this domain, it's going to grow, right? (I thought I was the only one who bought domains to make one-page websites, heh. ;-) Congrats DB, we'll make a javascript monkey out of you yet!
Your pal, -doc-
|
Bugimus
Maniac (V) Mad Scientist
From: New California Insane since: Mar 2000
|
posted 04-17-2002 17:14
Oooooooo. Very nice effect! I like it, I like it.
. . : newThing
|
Slime
Lunatic (VI) Mad Scientist
From: Massachusetts, USA Insane since: Mar 2000
|
posted 04-17-2002 18:56
You're missing some single quotes in the third and forth lnes of flashB1, before "m3". It's causing an error so I can't see it =/
|
docilebob
Maniac (V) Mad Scientist
From: buttcrack of the midwest Insane since: Oct 2000
|
posted 04-18-2002 03:44
Yea, Doc It`ll grow , prolly slow. But sure. Thanks again.
Thanks, bugs.
Max`s beauty tells me there`s an error in line 1 character 13. Line 1 has only 6 characters, so I guess its the missing quotes are the culprit, eh ? Thanks slime. I coulda looked for those for weeks.
One other silly question. In NN6.2, it works great as long as the table has a border. Set the border to 0 , and it times out before it loads the image. Is this just one of those Netscape things ?
|
Slime
Lunatic (VI) Mad Scientist
From: Massachusetts, USA Insane since: Mar 2000
|
posted 04-18-2002 05:07
Yeah, when it says there's an error at line one, it really means that there's an error either inside something like onmouseover="..." or onload="...", or there's an error in a setTimeout() or setInterval(). It might also do that with eval() errors. That's because these are pieces of code that the browser doesn't consider to be in the source of the page; it considers it to be off in it's own little domain, sort of.
|
docilebob
Maniac (V) Mad Scientist
From: buttcrack of the midwest Insane since: Oct 2000
|
posted 04-19-2002 01:46
Ah-HA ! That explains alot. Thanks again, Slime.
|