<!DOCTYPE html> <html> <title>Web Page Design</title> <head> <script> //task 4A document.write("Check weather today: <br>"); var weather = prompt ("Is the weather cloudy? "); if(weather == "Yes"){ document.write("Bring umbrella. "); } else{ document.write("Go out and play! "); } document.write("<br><br>"); //task 4B.1 document.write("Check weather today: <br>"); var weather = prompt ("Is the weather cloudy? "); weather = weather.toUpperCase(); if(weather == "YES"){ document.write("Bring umbrella. "); } else { document.write("Go out and play! "); } document.write("<br><br>"); //task 4B.2 document.write("Check weather today: <br>"); var weather = prompt ("What is the weather today? Use 'a' for cloudy, 'b' for sunny and 'c' for rainy"); if(weather == "a") { document.write("The weather today is cloudy. Bring an umbrella. "); } else if (weather == "b") { document.write("The weather today is sunny. Go out and play! "); } else { document.write("The weather today is rainy. Stay at home. ") } document.write("<br><br>"); </script> </head> <body> </body> </html>
We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy. Accept Learn more