javascript - Aptana Studio 3 Syntax Errors Unexpected Tokens -
<body> <p>count numbers: <output id="result"></output> </p> <button onclick="startworker()">start worker</button> <button onclick="stopworker()">stop worker</button> <br /> <br /> <script> var w; function startworker() { if (typeofworker) !== "undefined") { if (typeof(w) == "undefined") { w = new worker("demo_workers.js"); } w.onmessage = function(event) { document.getelementbyid("result").innerhtml = event.data; }; } else { document.getelementbyid("result").innerhtml = "sorry! no web worker support."; } } function stopworker() { w.terminate(); w = undefined; } </script> </body>
i have been teaching myself html5 on w3schools website. while trying replicate web workers .js tutorial, keep getting errors in section saying: syntax error: unexpected token "!==" on 1 line , syntax error: unexpected token "else". can't seem find out why, i've compared code original on site , same. appreciated.
the problems second line of first function ( !== ) , else further down being flagged unexpected tokens.
var = 0; function timedcount() { = + 1; postmessage(i); settimeout("timedcount()", 500); } timedcount();
this .js html above.
i feel kind of stupid...just reviewed code , found missing parenthesis in first if statemeent of first function in html script. goes show taking break , coming review code can solve many problems.
Comments
Post a Comment