When i am running a certain script ... I get "Uncaught SyntaxError: Unexpected token } eartraining.html:2" in the Chrome in the developer tools frame. the problem is it says the unexpected token is located in the html document and it refers me to the beginning of the document, before any of my external scripts are even loaded. HUH???
melodicpulse.webs.com/eartraining.html when you click on 'triad test' or 'seventh chord test' there is a quiz that pops up, then when you click on 'play sound' there is supposed to be a random sound file that plays, but instead I get that error message in the elements tab of the developer tools
Last edited by thewebiphyer; 02-11-2013 at 11:14 AM.
Looking at their code for the 'chdcheck()' function, it appears they expect at least 3 arguments.
However in the calling code, they are sending only two.
Probably the source of the fatal error.
Also, there are numerous CSS warnings (not fatal)
Have you contacted the authors if this is not your own?
well I fixed the argument issue and it's still telling me there's an unexpected token in HTML document. I still don't understand why it would say there's a script error in an HTML document. Either way I did look through the rest of the code and could not find anything that may be causing it.
well I fixed the argument issue and it's still telling me there's an unexpected token in HTML document. I still don't understand why it would say there's a script error in an HTML document. Either way I did look through the rest of the code and could not find anything that may be causing it.
It may not be in the HTML document. It holds the call to the external JS source file and that is where I think the problem is.
It reports the error being found in the HTML.
One other thing to check.
Code:
//-------------------------GENERATE CHORD QUIZ --------------------
function chd_quiz(type) {
if (document.getElementById('sound1').innerHTML == ""){
s=1; trys = 1; score = 0; counter = 1;
while (s < 21){
document.getElementById("sound"+s).innerHTML="<input \
type='button' onclick='change_chdsource("+s+","+s+",'"+type+"')' value='Play Chord' \
id=\""+s+"\" /><form id=''><input type='text' id='ui"+s+"' /><br><br>\
.....
//-----------------------generate random chord sound -----------
function change_chdsource(ques_num,buttonid,type) {
//------------------------first click ---------------
if (counter==1){
if(type=="tri"){
var chdtype="tri", select_qual=chdfolder('tri'); select_file = find();
}
else if(type=="sev"){
var chdtype="sev", select_qual=chdfolder('sev'); select_file = find();
}
'type' is a reserved word in HTML and maybe JS.
You might try changing it to something else. A bit more descriptive as to its function maybe.
I don't know if that will fix it, but it's a start.
Check the error console if using FF or Chrome browsers for a report on fatal and non-fatal errors.
well I'm not familiar with FF but i did try changing the 'type' variable and it still didn't do much... still trying to figure this out, but no luck yet. i did notice in FF it told me there was no character encoding declared but isn't that what the <!DOCTYPE html> tag does?
Last edited by thewebiphyer; 02-13-2013 at 12:53 PM.
Bookmarks