浏览器报错:unexpected end of input 解决方法

直接上报错代码:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <a href="javascript:void" onclick="test()">点我</a>
<script>
    function test() {
        alert("1");
    }
</script>
</body>
</html>

点击后,报错:unexpected end of input
浏览器报错:unexpected end of input 解决方法

检查以后发现在a标签的href属性哪里写错了void应该加上参数0,修改如下:

这里写代码片<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <a href="javascript:void(0)" onclick="test()">点我</a>
<script>
    function test() {
        alert("1");
    }
</script>
</body>
</html>

点击不在报错;

本文参考了:http://jingyan.baidu.com/article/fea4511a04bf56f7bb9125b7.html

上一篇:Linux 提示“syntax error: unexpected end of file”


下一篇:form表单ajax带file提交出现Processing of multipart/form-data request failed. Unexpected EOF read on the sock