This assignment asks you to create a bouncing smiley face screen saver using Dynamic HTML. The script below uses two variables, x_motion and y_motion, to keep track of the horizontal and vertical directions in which the smiley face is moving. These variables will either hold the value "plus" or "minus". A "plus" value calls for a number to be added to the current position. If the variable is x_motion, adding a value will move the smiley face to the right. If the variable is y_motion, adding a value will move the smiley face down.

<html> <head> <title>Chapter 13 Assignment</title> <script type = "text/javascript"> <!-- hide me from older browsers // set the direction // var x_motion = "plus"; var y_motion = "plus"; // set the borders ...

Get The Book of JavaScript, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.