Created
December 28, 2017 05:23
-
-
Save jarble/38c1bd541e03c4e5757acc48589753ce to your computer and use it in GitHub Desktop.
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> | |
<body> | |
<input type="text" id="input_box"/> <button id = "speak">Click me</button><br/><br/>Repeat how many times:<input type="text" id="repeat"/> | |
<script type = "text/javascript"> | |
var speak = function(){for(var i = 0; i < document.getElementById("repeat").value; i++) | |
window.speechSynthesis.speak(new SpeechSynthesisUtterance(document.getElementById('input_box').value));}; | |
window.onload = function(){document.getElementById('input_box').value = localStorage.getItem("input_box",""); document.getElementById('repeat').value = localStorage.getItem("repeat",""); speak();}; | |
document.getElementById("speak").onclick = speak; | |
document.getElementById("input_box").onkeyup = function(){localStorage.setItem('input_box', document.getElementById('input_box').value);}; | |
document.getElementById("repeat").onkeyup = function(){localStorage.setItem('repeat', document.getElementById('repeat').value);}; | |
</script> | |
</body> | |
</html> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment