SCRIPT1005:user.asp 中的预期“(”错误
SCRIPT1005: Expected '(' Error in user.asp
在我托管在服务器中的一个项目中,当我加载一页时在
中出现此错误
SCRIPT1005: Expected '('
File: users.asp, Line: 3, Column: 19
在代码中我有这个
<script language="javascript" type="text/javascript">
<!--
function datatable-users_onclick() {
}
// -->
</script>
但我不知道哪里遗漏了'(',就像错误所说的...
已编辑:
user.asp 文件
<!-- #include file="common/header.asp" -->
<!-- #include file="common/_db.asp" -->
<script language="javascript" type="text/javascript">
function datatable_users_onclick() {
}
</script>
<div class="row">
<div class="col-md-12">
<h2>Colaborador</h2>
<br/>
<table class="table dt-responsive" id="datatable-users" onclick="return datatable_users_onclick()">
<thead>
<tr>
<th>User-NT</th>
<th>Nome</th>
<th>Username</th>
<th>Acção</th>
</tr>
</thead>
</table>
</div>
</div>
<!-- Modal -->
<div class="modal fade" id="userAddModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog modal-sm" role="document">
<div class="modal-content">
<form method="post" action="user_save.asp" id="userAdd">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel">Novo Colaborador</h4>
</div>
<div class="modal-body">
<div class="form-group">
<p>Username:</p>
<input type="text" class="form-control input-sm" name="username" id="username" maxlength="50" required>
</div>
<div class="form-group">
<p>Password:</p>
<input type="text" class="form-control input-sm" name="password" id="password" maxlength="50" required>
</div>
<div class="form-group">
<p>Nome Completo:</p>
<input type="text" class="form-control input-sm" name="fullname" id="fullname" maxlength="50" required>
</div>
<div class="form-group">
<p>Departmento:</p>
<select class="form-control" name="department" id="department" required>
<% GetDepartments %>
</select>
</div>
<div class="form-group">
<p>Papel:</p>
<div class="radio">
<label><input type="radio" value="2" name="role" checked>Colaborador</label>
</div>
<div class="radio">
<label><input type="radio" value="1" name="role">Admin</label>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default btn-sm" data-dismiss="modal">Fechar</button>
<button type="submit" class="btn btn-primary btn-sm">Guardar</button>
</div>
</form>
</div>
</div>
</div>
<%
Sub GetDepartments
Set RS = Conn.Execute("SELECT * FROM Departments")
If Not RS.EOF Then
Do Until RS.EOF
departmentId = RS("id")
departmentName = RS("department")
Response.Write "<option value=" & departmentId & ">" & departmentName & "</option>"
RS.MoveNext
Loop
End If
RS.Close
End Sub
%>
<!-- #include file="common/footer.asp" -->
您可以使用任何字母、$ 或 _ 字符作为 variable/function 的开头。只要不以数字开头,您也可以包含数字。
开始:[a-z], $, _
包含:[a-z], [0-9], $, _
您使用的是无效的“-”,请改用 _
<script language="javascript" type="text/javascript">
function datatable_users_onclick() {
}
</script>
不能有连字符。应该是 datatable_users_onclick()
代替
datatable-users_onclick()
.
这是不理解服务器端和客户端代码之间区别的典型案例。
您收到的错误
SCRIPT1005: Expected '('
File: users.asp, Line: 3, Column: 19
来自 ASP 引擎,同时服务器正在执行脚本并且由于错误退出脚本并发送错误响应 (HTTP 500 Internal Server Error
) 到客户端 (Internet 浏览器).
根据 HTML 在 ASP 脚本中的输出位置,很可能
<script language="javascript" type="text/javascript">
<!--
function datatable-users_onclick() {
}
// -->
</script>
永远不会输出到客户端 (因此 ) .
所有关于客户端 JavaScript 函数名称不正确的答案都是正确的,但完全不相关,因为错误发生在任何响应发送到客户端之前。
错误将出现在等同于第 3 行的 ASP 代码块 <% %>
之一中。很可能您的函数或子过程调用缺少左括号 (
例如或 Response.Write()
语句出错了。
在我托管在服务器中的一个项目中,当我加载一页时在
中出现此错误SCRIPT1005: Expected '('
File: users.asp, Line: 3, Column: 19
在代码中我有这个
<script language="javascript" type="text/javascript">
<!--
function datatable-users_onclick() {
}
// -->
</script>
但我不知道哪里遗漏了'(',就像错误所说的...
已编辑: user.asp 文件
<!-- #include file="common/header.asp" -->
<!-- #include file="common/_db.asp" -->
<script language="javascript" type="text/javascript">
function datatable_users_onclick() {
}
</script>
<div class="row">
<div class="col-md-12">
<h2>Colaborador</h2>
<br/>
<table class="table dt-responsive" id="datatable-users" onclick="return datatable_users_onclick()">
<thead>
<tr>
<th>User-NT</th>
<th>Nome</th>
<th>Username</th>
<th>Acção</th>
</tr>
</thead>
</table>
</div>
</div>
<!-- Modal -->
<div class="modal fade" id="userAddModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog modal-sm" role="document">
<div class="modal-content">
<form method="post" action="user_save.asp" id="userAdd">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel">Novo Colaborador</h4>
</div>
<div class="modal-body">
<div class="form-group">
<p>Username:</p>
<input type="text" class="form-control input-sm" name="username" id="username" maxlength="50" required>
</div>
<div class="form-group">
<p>Password:</p>
<input type="text" class="form-control input-sm" name="password" id="password" maxlength="50" required>
</div>
<div class="form-group">
<p>Nome Completo:</p>
<input type="text" class="form-control input-sm" name="fullname" id="fullname" maxlength="50" required>
</div>
<div class="form-group">
<p>Departmento:</p>
<select class="form-control" name="department" id="department" required>
<% GetDepartments %>
</select>
</div>
<div class="form-group">
<p>Papel:</p>
<div class="radio">
<label><input type="radio" value="2" name="role" checked>Colaborador</label>
</div>
<div class="radio">
<label><input type="radio" value="1" name="role">Admin</label>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default btn-sm" data-dismiss="modal">Fechar</button>
<button type="submit" class="btn btn-primary btn-sm">Guardar</button>
</div>
</form>
</div>
</div>
</div>
<%
Sub GetDepartments
Set RS = Conn.Execute("SELECT * FROM Departments")
If Not RS.EOF Then
Do Until RS.EOF
departmentId = RS("id")
departmentName = RS("department")
Response.Write "<option value=" & departmentId & ">" & departmentName & "</option>"
RS.MoveNext
Loop
End If
RS.Close
End Sub
%>
<!-- #include file="common/footer.asp" -->
您可以使用任何字母、$ 或 _ 字符作为 variable/function 的开头。只要不以数字开头,您也可以包含数字。
开始:[a-z], $, _
包含:[a-z], [0-9], $, _
您使用的是无效的“-”,请改用 _
<script language="javascript" type="text/javascript">
function datatable_users_onclick() {
}
</script>
不能有连字符。应该是 datatable_users_onclick()
代替
datatable-users_onclick()
.
这是不理解服务器端和客户端代码之间区别的典型案例。
您收到的错误
SCRIPT1005: Expected '('
File: users.asp, Line: 3, Column: 19
来自 ASP 引擎,同时服务器正在执行脚本并且由于错误退出脚本并发送错误响应 (HTTP 500 Internal Server Error
) 到客户端 (Internet 浏览器).
根据 HTML 在 ASP 脚本中的输出位置,很可能
<script language="javascript" type="text/javascript">
<!--
function datatable-users_onclick() {
}
// -->
</script>
永远不会输出到客户端 (因此
所有关于客户端 JavaScript 函数名称不正确的答案都是正确的,但完全不相关,因为错误发生在任何响应发送到客户端之前。
错误将出现在等同于第 3 行的 ASP 代码块 <% %>
之一中。很可能您的函数或子过程调用缺少左括号 (
例如或 Response.Write()
语句出错了。