student:demo
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| student:demo [2020/04/13 18:48] – jonathan | student:demo [2020/04/13 19:40] (current) – jonathan | ||
|---|---|---|---|
| Line 22: | Line 22: | ||
| {{: | {{: | ||
| + | |||
| + | [[https:// | ||
| + | |||
| + | **What is FizzBuzz**? Write a program that prints the numbers from 1 to 100. But for multiples of three print " | ||
| + | |||
| + | See the post [[https:// | ||
| + | |||
| Line 30: | Line 37: | ||
| * [[https:// | * [[https:// | ||
| - | <html> | + | <HTML> |
| - | + | <iframe width="560" | |
| - | | + | src=" |
| - | + | frameborder="0" allow=" | |
| - | < | + | encrypted-media; gyroscope; picture-in-picture" |
| - | // 2. This code loads the IFrame Player API code asynchronously. | + | allowfullscreen> |
| - | var tag = document.createElement(' | + | </iframe> |
| - | + | </HTML> | |
| - | tag.src = " | + | |
| - | var firstScriptTag | + | |
| - | firstScriptTag.parentNode.insertBefore(tag, | + | |
| - | + | ||
| - | // 3. This function creates an < | + | |
| - | // after the API code downloads. | + | |
| - | var player; | + | |
| - | function onYouTubeIframeAPIReady() { | + | |
| - | player | + | |
| - | height: ' | + | |
| - | width: ' | + | |
| - | videoId: ' | + | |
| - | events: { | + | |
| - | ' | + | |
| - | ' | + | |
| - | } | + | |
| - | }); | + | |
| - | } | + | |
| - | + | ||
| - | // 4. The API will call this function when the video player is ready. | + | |
| - | function onPlayerReady(event) { | + | |
| - | event.target.playVideo(); | + | |
| - | } | + | |
| - | + | ||
| - | // 5. The API calls this function when the player' | + | |
| - | // The function indicates that when playing a video (state=1), | + | |
| - | // the player should play for six seconds and then stop. | + | |
| - | var done = false; | + | |
| - | function onPlayerStateChange(event) { | + | |
| - | if (event.data == YT.PlayerState.PLAYING && !done) { | + | |
| - | setTimeout(stopVideo, | + | |
| - | done = true; | + | |
| - | } | + | |
| - | } | + | |
| - | function stopVideo() { | + | |
| - | player.stopVideo(); | + | |
| - | } | + | |
| - | | + | |
| - | </html> | + | |
student/demo.1586803725.txt.gz · Last modified: by jonathan
