我的代码中缺少什么?我在开发人员控制台中遇到以下错误。
SELECT [Community].[CommunityID], [Community].[CommunityName], [Community].[StateID], [StateName] AS [StateName], [Community].[LGAID], [LGA].[LGName] AS [LGName]
FROM [Community] JOIN [State] ON [Community].[StateID] = [State].[StateID]
JOIN [LGA] ON [Community].[LGAID]=[LGA].[LGAID]
完整代码:
Uncaught SyntaxError: missing ) after argument list
我想我错过了这句话:
.html('<textarea id="textarea" rows="1" class="form-control chatboxtextarea" data-autosize-on="true" style="overflow: hidden; word-wrap: break-word; height: 30px;"
onkeypress="javascript:return updateLastTypedTime();" onkeyup="javascript:return refreshTypingStatus(' + chatboxtitle + "','" + toid + "');\"
onkeydown=\"javascript:return checkChatBoxInputKey(event,this,'" + chatboxtitle + "','" + toid + "','" + img + '\');">
</textarea>');
但我真的无法罚款:/
答案 0 :(得分:2)
.html(
'<textarea id="textarea" rows="1" class="form-control chatboxtextarea" data-autosize-on="true" style="overflow: hidden; word-wrap: break-word; height: 30px;"
onkeypress="javascript:return updateLastTypedTime();"
onkeyup="javascript:return refreshTypingStatus(' + chatboxtitle + "','" + toid + "');\"
onkeydown=\"javascript:return checkChatBoxInputKey(event,this,'" + chatboxtitle + "','" + toid + "','" + img + '\');">
这些报价是一团糟。问题就出在这里:
'...refreshTypingStatus(' + chatboxtitle + "','" + toid + "')
^ ^ ^
| | |
| Your closing Your opening quote for
Your opening quote quote for the another string literal.
for the string string literal These are suddenly
literal double quotes. Bad.
Don't mix up quotes.
因此,当html()
函数插入HTML时,您的refreshTypingStatus()
函数会变为:
refreshTypingStatus(Nice title','My very own toid')
如您所见,标题不以引号开头。您只需要插入引号:
'...refreshTypingStatus(\'' + chatboxtitle + "','" + toid + "')..."