textarea光标默认第一行第一个字符。
可以在已经写的任意位置添加内容。
兼容Firefox, Google , IE8+
1、HTML
<textarea id = "textarea" onmousedown = "s(event, this)" cols = "30" rows = "10" style = "width : 500px; height: 200px;" ></textarea>
2、JS
functions(e,a)
{
if( e && e.preventDefault)
e.preventDefault();
else
window.event.returnValue=false;
a.focus();
}
3、CSS
#textarea{
resize: none;
padding: 10px;
}
网友评论