gpt4 book ai didi

javascript - 我的 js 代码中缺少的内容我正在丢失)错误

转载 作者:行者123 更新时间:2023-12-01 03:35:50 24 4
gpt4 key购买 nike

我的代码中缺少什么?我在开发者控制台中收到以下错误。

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>');

我想我错过了这一行的一些内容:

onkeypress="javascript:return updateLastTypedTime();" onkeyup="javascript:return refreshTypingStatus(' + chatboxtitle + "','" + toid + "');\"

但是我真的不能被罚的地方:/

最佳答案

.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 + "')..."

关于javascript - 我的 js 代码中缺少的内容我正在丢失)错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44295717/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com