+1

why can't this work? I want it to speak the output

<!DOCTYPE html> <html> <head> <title>Page Title</title> </head> <body> <script src='https://code.responsivevoice.org/responsivevoice.js'> function sayHello(name) { alert("Hi " + name + ", welcome to your math test score , please click next to continue🤗"); document.write("Hi, " + name + " "); } sayHello( prompt("HELLO,PLEASE ENTER YOUR NAME") ); var maths; //math section maths=parseInt(prompt("Enter Your Maths score")); if(maths>=101) document.write( "YOUR MATH SCORE CAN'T BE GREATER THAN 100" + "<br />" +"and"+ "<br />"); else if (maths>=50 ) responsiveVoice.speak(maths); document.write("congrat, you have passed in Maths"+ "<br />" +"and"+ "<br />"); responsiveVoice.speak(maths); </script> </body> </html>

3/26/2019 12:36:54 PM

Glory222

3 Answers

New Answer

+5

responsiveVoice.voiceSupport() appears to return false for Code Playground. According to the FAQ, the library appears to have limited support for Android devices. It may work on Chrome on Android, and native browsers, but apparently not on Code Playground. https://responsivevoice.org/faq/

+2

A script tag can either have a src attribute or can contain JS code but not both. You're using the same script tag to embed link as well as for writing JS code. Write your JS code in a separate script tag and it'll work.

+1

Could someone rewrite it for me!? I'm really bad at this language (js)