0

我想在输入按钮上按时钟更新 textarea 内容

例如:

<input type="button" value="Reply" onclick="update('Ahmed')">
<textarea id="comment_content"></textarea>
//i want set textarea content to @/Ahmed/ onclick on the above button
//example for the javascript function
function update(var){
getElementByID('comment_content') = '@/'.var.'/'
//set the textarea to @/Ahmed/
}

我还有一个问题..我想点击按钮,我想将用户发送到页面末尾(到 new_comment div)

我想要javascript代码,而不是jquery

4

2 回答 2

2
function update(name){
    document.getElementById('comment_content').value = '@/' + name + '/';
}
于 2012-06-17T13:23:22.667 回答
1
function update(val)
{
   document.getElementById('comment_content').value = val;
}

滚动到底部是:

window.scrollTo(0,document.body.scrollHeight);
于 2012-06-17T13:25:41.717 回答