I'm glad to hear that you found a workaround.
After playing with your html code, it appears that the script error was related to this line of code:
<body onload="document.form.name.focus();">
I created a Custom item (see attached files) without that line in it and based on the same Sample code you used. I also changed the <ml.totals> to <ml.varname> to get the responses in the boxes to record in the MediaLab data file. Where did you get the use of <ml.totals>?
It ran on MediaLab 2014 without the script error box and successfully recording the data. Feel free to take a look. After downloading the .txt file, make sure to change the file format to .htm to use it with the .que file.