scroll down effect, problem with setInterval
Posted on 2004-08-06
I wanted to put a DIV in a page, then every time the user moves mouse over it, I wanted it to clip downward. (To have something like an scroll efect).
I tried this first:
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
In this model, show function would be used for setting the visibility of DIV. (I need this, because I want to set the visibility of some other DIVs at the same time).
The variable sent to it is the DIV object, obviously. Now the scroll function (which must be later coded to clip the DIV object), contains only a test code. If it is run correctly, it must fill the status bar with [object] s.
It failed! It said, "object is undifined"
I changed the show(x) function to such:
It gave me the same error message.
I thought this is because I am trying to send the X variable to a function outside the show(x) function, and thus, X is undifined to the scroll(n) function. So:
It again failed! This time one [object] was shown in the status bar (because windo.status command was run once, when it was called by the mousover event.) But it failed to repeat.
I have always used setInterval and setTimeout for functions that do not need arguments,ie setInterval("func()",time), and not for those which need arguments, ie setInterval("func(arg)",time). But I need this now.
A simple code that can result in a drop down effect is excellent!