您的位置:首页 > 其它

textarea的滚动条是否开启

2016-04-04 14:48 211 查看
要设置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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: