You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 1542d16
Browse filesBrowse the repository at this point in the historyBrowse files
Why wear a watch when you can check the time, live in your webpage?
14
+
15
+
1. Create an empty HTML file, called `time.html`
16
+
2. Create a JavaScript file called `showCurrentTime.js` and include it in the HTML file
17
+
3. Inside the JS file, write a function that adds the current time to the webpage. Make sure it's written in the HH:MM:SS notation (hour, minute, second). Hint: use `setInterval()` to make sure the time stays current
18
+
4. Have the function execute when it's loading in the browser
Start with this webpage, which has a single img tag of an animated GIF of a cat walking.
23
+
24
+
1. Add a script tag at the bottom of the page, where you'll put all your code.
25
+
2. Create a variable to store a reference to the img.
26
+
3. Change the style of the img to have a "left" of "0px", so that it starts at the left hand of the screens.
27
+
4. Create a function called catWalk() that moves the cat 10 pixels to the right of where it started, by changing the "left" style property.
28
+
5. Call that function every 50 milliseconds.Your cat should now be moving across the screen from left to right.Hurrah!
29
+
6. When the cat reaches the right - hand of the screen, restart them at the left hand side("0px").So they should keep walking from left to right across the screen,
30
+
forever and ever.
31
+
7. When the cat reaches the middle of the screen, replace the img with an image of a cat dancing(use this URL: https://tenor.com/StFI.gif), keep it dancing for 5 seconds,
32
+
and then replace the img with the original image and have it continue the walk.
0 commit comments