+ 4
HTML ------- <!DOCTYPE html> <html> <head> <title>Page Title</title> </head> <body> <button onclick="change()">Change</button> </body> </html> JS ---- let count = 0; function change() { if(count == 3) { body = document.getElementsByTagName("body")[0]; body.style.background = "red"; } count++; }
22nd Oct 2017, 4:49 PM
ChaoticDawg
ChaoticDawg - avatar