Reputation: 165
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>
Upvotes: 1
Views: 653
Reputation: 313
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 ")"
Upvotes: 4
Reputation: 543
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>
Upvotes: 1
Reputation: 409216
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.
Upvotes: 4