2016-02-09 33 views
-2

這真的很奇怪,但在「textarea10t0」結尾處有一個0使得它在您設置嘗試設置textarea的行時不起作用。從字面上看,將結局改爲其他任何東西,它就會起作用。我瘋了嗎?textarea10t0令人不安的奇怪的ID不起作用

$textareaID = "textarea10t1"; 
<textarea id = '$textareaID' placeholder = 'Type something' onkeydown = \"test('editNotifyCommentSecond.php','{$outputID}', '{$textareaID}')\">$notifyComment</textarea> 

<script> 
//code 
document.getElementById("textarea10t0").rows = 50; 
</script> 
+0

看起來像一個js問題不是php一個 –

+0

PHP開放/關閉標記在哪裏? – chris85

+0

你是否將該元素設置爲0? –

回答

0

您錯過了php的結束標記以及嵌入php變量的HTML echo聲明。另外,在上例中,textarea中的id與js id不匹配。如果您將html id更改爲最終爲0,則還需要更改js代碼。

<?php 
$textareaID = "textarea10t0"; 
echo "<textarea id = '$textareaID' placeholder = 'Type something' onkeydown = \"test('editNotifyCommentSecond.php','{$outputID}', '{$textareaID}')\">$notifyComment</textarea>" 
?> 
<script> 
//code 
document.getElementById("textarea10t0").rows = 50; 
</script> 
相關問題