From 3677a9c3997f66d7be6ee0111ce7ba644fdb027c Mon Sep 17 00:00:00 2001 From: Galih Anggoro Prasetya <83481679+galihap76@users.noreply.github.com> Date: Thu, 8 Sep 2022 20:52:22 +0700 Subject: [PATCH] Create script.js --- script.js | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 script.js diff --git a/script.js b/script.js new file mode 100644 index 0000000..ad8d2be --- /dev/null +++ b/script.js @@ -0,0 +1,35 @@ +// JavaScript Document + +//make variabel +let textArea = document.getElementById('textArea'); +let btn = document.getElementsByTagName('button')[0]; + +// check if you click on the button +btn.addEventListener('click', function(){ + + //check if textarea is blank + if(textArea.value==""){ + //give alert + alert("Please don't be blank!"); + + //check if you has been enter a text on textarea + }else{ + + //init responVoice speak + responsiveVoice.speak( + + //take the tag textarea + textArea.value, + + //choose us english female + "US English Female", + { + + //give a voice + pitch: 1, + rate: 1, + volume: 1 + } + ); + } +});