now toggle the clock and the button text, depending on current state Var clockButton = document.getElementById('clockButton') also get the clock button, so we can change what it says get the current value of the clock's display property Var m圜lock = document.getElementById('clock') Here's that function - just add it to the existing script section in the head of your web page: Now that you have a button that, when clicked, calls the toggleClock() function, you need to create a toggleClock() function. ![]() That's so you can access it easily using JavaScript (you'll see why in a moment). ![]() Note that this button is essentially the same as the one you created in Lesson 1 to show the alert.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |