1

I tried hard to find this error, deleted all unnecessary nodes. but still,

I can't find it.

Uncaught SyntaxError: Unexpected end of input test.html:28

html

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>파일 다운로드</title>
</head>


<body>
  <div class="wrap">
    <table width="500" cellpadding="0" cellspacing="0" border="1" class="blueone">

      <tr>
        <th>파일명</th>
        <th>진행상황</th>
        <th>다운로드</th>
        <th>시정지</th>
      </tr>

      <tr>
        <td id="100Mb.dat">File10MB</td>
        <td><progress id="progress" value="0"></progress><span id="display"></span>       </td>
        <td class="test"><a class="checkBtn checkBtn1" onclick="downloadFile(event, "100Mb.dat")">다운로드</a></td> //Uncaught SyntaxError: Unexpected end of input
        <td><a class="pauseBtn pauseBtn1" onclick="stop(1);" value="ACTION">일시정지</a><a class="resumeBtn resumeBtn1" onclick="resume(1);" value="ACTION">다시시작</a></td>
      </tr>

    </table>

  </div>
</body>

</html>
1
  • 3
    onclick="downloadFile(event, "100Mb.dat" You forgot to escape. Better to attach handler properly using Javascript instead Commented Feb 8, 2019 at 8:51

3 Answers 3

4

The problem is with

onclick="downloadFile(event, "100Mb.dat")"

You can't have double quotes within double quotes here.

Either escape the inner quotes or use single quotes for one pair.

Sign up to request clarification or add additional context in comments.

Comments

4

As said in the error, line 28:

onclick="downloadFile(event, "100Mb.dat")"

You are using double quotes for "100Mb.dat", which is breaking the onclick ones. And browser parses (understands) it this way..

onclick="downloadFile(event, "         100Mb.dat          ")"

Comments

1

Inside double-quote use semi-quote mark like this:

onclick="downloadFile(event, '100Mb.dat')"

All code:

<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>파일 다운로드</title>
</head>
    <script language="JavaScript" type="text/javascript" src="js/jquery-3.2.1.js"></script>
    <script src="js/myscript.js"></script>
    <!-- <script src="js/downloadJs.js"></script> -->
    <script src="js/distribute.js"></script>
<body>
  <div class="wrap">
    <table width="500" cellpadding="0" cellspacing="0" border="1" class="blueone">
      <tr>
        <th>파일명</th>
        <th>진행상황</th>
        <th>다운로드</th>
        <th>시정지</th>
      </tr>
      <tr>
        <td id="100Mb.dat">File10MB</td>
        <td><progress id="progress" value="0"></progress><span id="display"></span></td>
        <td class="test"><a class="checkBtn checkBtn1" onclick="downloadFile(event, '100Mb.dat')">다운로드</a></td>
        <td><a class="pauseBtn pauseBtn1" onclick="stop(1);" value="ACTION">일시정지</a><a class="resumeBtn resumeBtn1" onclick="resume(1);" value="ACTION">다시시작</a></td>
      </tr>
    </table>
  </div>
</body>
</html>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.