我用下面的代碼在PHP:未結束的字符串常量的Javascript
PHP:
$suggested_sentence[0] = "Hello, how are you?";
echo $suggested_sentence[0] . ' <input type="image" src="button.png"
onclick = update_textarea('. $textareacount.','. "'".$suggested_sentence[0]."')/>";
JavaScript函數:
function update_textarea(count, new_sentence) {
document.getElementById('sentence' + count).value = new_sentence;
}
但是,當我按下按鈕,我得到的錯誤「未終止的字符串文字,但如果我更改$suggested_sentence[0] = "Hello"
它的工作正常的值
那我該怎麼辦?
什麼是PHP的產生? – kennytm 2010-07-10 07:26:29