Why does my jsfiddle work but not my web site? [closed]

折月煮酒 提交于 2019-11-29 09:01:53

​ from copying and pasting from fiddle

Just before your closing </script> tag, you've got an illegal character. Try right-clicking and 'view-source' in Chrome. You'll see it. Line #68.

On the line 68 you have illegial symbols right after a closing bracket }.

Remove it and the code should work.

Open up your console, it says: Uncaught SyntaxError: Unexpected token ILLEGAL, demo.php:68

    ...
    var total1 = document.getElementById("total1").value = total;

}​

These might be caused by a BOM if you're using different files/includes to generate the output. Otherwise, it might just be some copy/paste error. Just remove the }​</script> to make sure the 'invisible' chars are gone between } and < and then type }</script> again and be done with it.

Seems to work just fine, except you have a random trio of symbols at the end of your <script>, so remove those and it should be just fine.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!