2
我想將兩個變量傳遞給JavaScript函數:輸入本身和用戶標識。我使用輸入的onclick屬性調用函數。SyntaxError:標識符在數字文字後立即啓動。將php變量傳遞給JavaScript
echo "<input type = 'submit' class = 'replyButton' id = 'replyButton'
value = 'reply' onclick = 'insertComment(this, $user_id);'>";
變量進入一個JavaScript功能:
function insertComment(input, user)
{
//use input and user id to carry out tasks.
}
給出該錯誤消息是在輸入的onclick的函數調用「insertComment()」。該錯誤信息是這樣的:
SyntaxError: identifier starts immediately after numeric literal
insertComment(this, 9f60d869342a);
我曾嘗試多種報價和點的組合,並檢查了計算器的其他職位。他們都無濟於事。 我們非常感謝您幫助解決此錯誤。
的可能的複製:([SyntaxError錯誤標識後在Firebug數字文字立即開始] http://stackoverflow.com/questions/14966133/syntaxerror-identifier-starts在數字文字中立即在螢火蟲) – Amir