码迷,mamicode.com
首页 > 其他好文 > 详细

textarea的滚动条是否开启

时间:2016-04-04 16:15:35      阅读:136      评论:0      收藏:0      [点我收藏+]

标签:

要设置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

textarea的滚动条是否开启

标签:

原文地址:http://www.cnblogs.com/teng-xia/p/5352028.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!