要设置textarea文本域的滚动条是否开启,使用style.overflow-x属性来控制。如:如果要隐藏该文本域的横向滚动条,在style属性中增加overflow-x属性控制,如下:
<textarea id=txtComments style="overflow-x:hidden"></textarea>
相应的,若要隐藏纵向滚动条:
<textarea id=txtComments style="overflow-y:hidden"></textarea>
如果使用代码控制的话,可能需要如下代码实现:
document.all("txtComments").style.overflowX="hidden";
overflow-x,overflow-y的可取值为:visible(默认取值),hidden,auto,scroll。具体解释参加如下文档(摘自MSDN帮助文档):
visible (Default)- Content is not clipped and scroll bars are not added. Elements are clipped to the size of the containing window or frame.
scroll -Content is clipped and scroll bars are added, even if the content does not exceed the dimensions of the object.
hidden Content that exceeds the dimensions of the object is not shown.
auto Content is clipped and scrolling is added only when necessary.
原文链接:http://blog.sina.com.cn/s/blog_4d54fab10100la4q.html