IE8插入文本到textarea问题 [英] IE8 inserting text to textarea problem

查看:84
本文介绍了IE8插入文本到textarea问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些代码将标签插入到textarea(对于Internet Explorer)。
但我有问题与IE8。如果有很多文本,我会尽量在最后插入文本 - 它会滚动。



代码:

 < script type =text / javascript> 
函数bold()
{
var text1 = document.getElementById('text1');
var sel ='';
if(document.selection)
{
sel = document.selection.createRange();
sel = sel.text;
}
if(sel)
{
text1.focus();
document.selection.createRange()。text ='< strong>'+ sel +'< / strong>';
}
}
< / script>