HTML and CSS Reference
In-Depth Information
To Enter the stopFloat() Function
The stopFloat() function stops the image from floating when the visitor moves the mouse over the image.
The function, stopFloat(), responds to an onMouseOver event handler. Table 11-14 shows the JavaScript code
for the stopFloat() function.
Table 11-14 Code for the stopFloat() Function
Line
Code
31
function stopFloat() {
32
clearTimeout(imager)
33
}
Line 31 defines the stopFloat() user-defined function. The clearTimeout() method on line 32 stops the floating
image by clearing the imager variable used in the recursive call made by the setTimeout() method on line 28 in
Table 11-13. Line 33 closes the stopFloat() function.
The following step enters the stopFloat() user-defined function.
1
line 31.
If necessary, click
in Table 11-14 to
create the stopFloat()
user-defined function,
indenting as shown.
Enter the code shown
clearTimeout
stops image
Press the
e n t e r key
twice to position the
insertion point on
line 35 (Figure 11-22).
press e n t e r
key twice
Figure 11-22
To Enter the restartFloat() Function
The restartFloat() function restarts the image scrolling when the visitor moves the mouse off the floating
image. This function, restartFloat(), responds to an onMouseOut event handler. Table 11-15 shows the code for the
restartFloat() user-defined function.
Table 11-15 Code for the restartFloat() Function
Line
Code
function restartFloat() {
35
setTimeout(“floatingImage()”,100)
36
}
37
Line 35 declares the function. Line 36 uses the setTimeout() method to call the floatingImage() user-defined
function. Line 37 closes the restartFloat() function code.
 
Search WWH ::




Custom Search