评论框很好用,<textarea>
但我需要用div
它来代替它。这是文本区号:
<textarea class="commentMark" id="commentMark-<?php echo $row['p_id'];?>" onblur="if (this.value=='') this.value = 'Write a comment'" onfocus="if (this.value=='Write a comment') this.value = ''" onKeyPress="return SubmitComment(this,event)" wrap="hard" name="commentMark" style=" background-color:#fff; overflow: hidden;" cols="60">Write a comment</textarea>
我试图用contenteditable
div替换它
<div class="commentMark" id="commentMark-<?php echo $row['p_id'];?>" onblur="if (this.value=='') this.value = 'Write a comment'" onfocus="if (this.value=='Write a comment') this.value = ''" onKeyPress="return SubmitComment(this,event)" wrap="hard" name="commentMark" style=" background-color:#fff; overflow: hidden;" cols="60">Write a comment</div>
但是当我按下输入评论时,在文本区域中被发布。当我进入 div 时,它不会产生任何效果。
单击“评论”按钮也会出现 div