daily pastebin goal
31%
SHARE
TWEET

Untitled

a guest Aug 10th, 2018 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE HTML>
  2. <html lang="en-us">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>Choose correct shoes</title>
  6.  
  7. <script>
  8. /* Input: Weather
  9. * Processing: process user input
  10. * Output: shoes based on selection
  11. */
  12.     function selectShoes(){
  13.     // Read Weather from the user
  14.         var weather = document.getElementById("weather").value;
  15.         var shoes = document.getElementById("shoes");
  16.         // Process input
  17.         if (weather == "hot"){
  18.         shoes = "sandals";
  19.         } else if(weather == "rain"){
  20.             shoes = "galoshes";
  21.             } else if(weather == "snow"){
  22.                 shoes = "boots";
  23.             } else {shoes = "shoes";}
  24.         // Display shoes
  25.         document.getElementById("shoes").innerHTML = "You should choose " + shoes;
  26.     }
  27. </script>
  28. </head>
  29.  
  30. <body>
  31. <br>Input weather<input type="text" id="weather" placeholder="#">
  32. <button type="button" onclick="selectShoes();">Select Shoes</button>
  33. <div id="shoes"></div>
  34. </body>
  35. </html>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top