Last active
December 15, 2015 22:29
-
-
Save johntips/5333796 to your computer and use it in GitHub Desktop.
プログラミング方法論 第一回授業課題 FizzBuzz
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="utf-8" /> | |
| <!-- Always force latest IE rendering engine (even in intranet) & Chrome Frame | |
| Remove this if you use the .htaccess --> | |
| <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> | |
| <title>fizzbuzz</title> | |
| <meta name="description" content="" /> | |
| <meta name="author" content="teiyuueki" /> | |
| <meta name="viewport" content="width=device-width; initial-scale=1.0" /> | |
| <!-- Replace favicon.ico & apple-touch-icon.png in the root of your domain and delete these references --> | |
| <link rel="shortcut icon" href="/favicon.ico" /> | |
| <link rel="apple-touch-icon" href="/apple-touch-icon.png" /> | |
| </head> | |
| <body> | |
| <header> | |
| <h1>fizzbuzz</h1> | |
| </header> | |
| <input type="button" value="SAY!" onclick="do_say()" /> | |
| <div id= "display_area"></div> | |
| <script type="text/javascript"> | |
| var said_count= 0; | |
| function do_say() { | |
| said_count = said_count + 1; | |
| var display_area_element = document.getElementById("display_area") | |
| if(said_count % 15 == 0){ | |
| display_area_element.innerHTML = "<h2>Fizz Buzz</h2>"; | |
| }else if(said_count % 3 == 0){ | |
| display_area_element.innerHTML = "<h3>Fizz</h3>"; | |
| }else if(said_count % 5 ==0){ | |
| display_area_element.innerHTML = "<h3>Buzz</h3>"; | |
| }else{ | |
| display_area_element.innerHTML = said_count; | |
| } | |
| } | |
| // --> | |
| </script> | |
| <footer> | |
| <p> | |
| © Copyright by teiyuueki | |
| </p> | |
| </footer> | |
| </div> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment