文本区域10T0 令人不安的奇怪 ID 不起作用


textarea10t0 disturbing weird id that don't work

这真的很奇怪,但是在"textarea10t0"的末尾有一个0,所以当你设置尝试为文本区域设置行时,它不起作用。从字面上看,将结局更改为其他任何东西,它就会起作用。我疯了吗?

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

你缺少 php 的结束标记和带有嵌入式 php vars 的 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>