HTML and CSS Reference
In-Depth Information
EXAMPLE 10.13 ( CONTINUED )
13
function scrollAgain(){
pixelpos = 0; // Reset the horizontal pixel position to 0
14
startScroll(); // Start scrolling again
}
function stopHere(){
15
clearTimeout(timeout); // Stop the clock to stop scrolling
}
function closeWindow(){
16
winObj.close();
}
</script>
</head>
<body bgColor="lightgreen">
<font face="arial" size=4 >
<b><br />
<div align="center">
A Window into an Autumn Day
<form>
17 <input type="button"
value="Start scrolling"
onClick="startScroll();">
<input type="button"
value="Stop scrolling"
onClick="stopHere();">
<input type="button"
value="Start over"
onClick="scrollAgain();">
</form></font>
<font size=-1>
<p>When you are ready to close the window, click here<br />
18 <a href="JavaScript:closeWindow()">Close the window</a>
</font>
</body>
</html>
EXPLANATION
1
A new window object is created. It will contain a .gif image of a fall scene.
2
The new window object is moved up to the top left corner of the browser (coordi-
nates 0,0).
3
The focus() method puts the window on top of all other opened windows.
4
The initial pixel position that will be used for scrolling is set to 0.
5
The variable ImgWidth is assigned 1096 , which will be used to represent the size
of the image in pixels.
6
Each time the image moves to the right, it will be moved 2 pixels in intervals of
.02 seconds.
Continues
Search WWH ::




Custom Search