默认情况是这样的,点击添加只能加在最后
<form name='NewRemark'>
<textarea cols=80% name='log_r_content' rows='6'></textarea>
</form>
<a title=加入心情图标 onClick=inputs(':)')><img src="http://www.cnbruce.com/blog/smile/face7.gif"></a>
[Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行]
下面的则解决了任意位置的添加。
[Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行]
<script language=javascript>
function inputs(str)
{document.NewRemark.log_r_content.value=document.NewRemark.log_r_content.value+str;}
</script>
function inputs(str)
{document.NewRemark.log_r_content.value=document.NewRemark.log_r_content.value+str;}
</script>
<form name='NewRemark'>
<textarea cols=80% name='log_r_content' rows='6'></textarea>
</form>
<a title=加入心情图标 onClick=inputs(':)')><img src="http://www.cnbruce.com/blog/smile/face7.gif"></a>
下面的则解决了任意位置的添加。
<script language=javascript>
var ie = (document.all)? true:false
if (ie)
{
function fastPost(eventobject)
{
if(event.ctrlKey && window.event.keyCode==13)
{
var o=window.document.PostTopic;
if(ie && o.BackupContent.checked)
window.clipboardData.setData("Text",o.Message.value);
o.submit();
}
}
}
function DisableEvent(){return false;}
var currentpos,timer;
function initialize(){timer=setInterval("scrollwindow()",16);}
function sc(){clearInterval(timer);}
function scrollwindow()
{
currentpos=document.body.scrollTop;
window.scroll(0,++currentpos);
if (currentpos != document.body.scrollTop)
sc();
}
document.onmousedown=sc
document.ondblclick=initialize
function getActiveText(o){o.currPos = document.selection.createRange().duplicate();}
function addText(str) {
var o=document.PostTopic.Message;
if (o.createTextRange && o.currPos) {
var currPos = o.currPos;
currPos.text = str;
}
else o.value += str;
//o.focus(currPos);
o.focus();
}
function setsmiley(what) {addText(" "+what);}
</script>
<body>
<FORM METHOD=POST NAME=PostTopic>
<TEXTAREA NAME=Message ROWS=10 COLS=50 WRAP=VIRTUAL onkeydown=fastPost()
onfocus=getActiveText(this) onclick=getActiveText(this)
onchange=getActiveText(this)></textarea> <BR>
<a href="javascript:setsmiley(':)')"><img alt='smaile' align=absmiddle
src=http://www.blueidea.com/BBS/images/smile.gif border=0></a>
</FORM>
var ie = (document.all)? true:false
if (ie)
{
function fastPost(eventobject)
{
if(event.ctrlKey && window.event.keyCode==13)
{
var o=window.document.PostTopic;
if(ie && o.BackupContent.checked)
window.clipboardData.setData("Text",o.Message.value);
o.submit();
}
}
}
function DisableEvent(){return false;}
var currentpos,timer;
function initialize(){timer=setInterval("scrollwindow()",16);}
function sc(){clearInterval(timer);}
function scrollwindow()
{
currentpos=document.body.scrollTop;
window.scroll(0,++currentpos);
if (currentpos != document.body.scrollTop)
sc();
}
document.onmousedown=sc
document.ondblclick=initialize
function getActiveText(o){o.currPos = document.selection.createRange().duplicate();}
function addText(str) {
var o=document.PostTopic.Message;
if (o.createTextRange && o.currPos) {
var currPos = o.currPos;
currPos.text = str;
}
else o.value += str;
//o.focus(currPos);
o.focus();
}
function setsmiley(what) {addText(" "+what);}
</script>
<body>
<FORM METHOD=POST NAME=PostTopic>
<TEXTAREA NAME=Message ROWS=10 COLS=50 WRAP=VIRTUAL onkeydown=fastPost()
onfocus=getActiveText(this) onclick=getActiveText(this)
onchange=getActiveText(this)></textarea> <BR>
<a href="javascript:setsmiley(':)')"><img alt='smaile' align=absmiddle
src=http://www.blueidea.com/BBS/images/smile.gif border=0></a>
</FORM>
[Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行]