如何在点击时扩展textarea? [英] How to expand a textarea on click?
本文介绍了如何在点击时扩展textarea?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个带有文本区域的UI,只有2行和10个字符串。
点击/焦点时,文本区域应该展开。
只有在中继器内的文本区域必须扩展,而不是其他区域。
先谢谢!
I have a UI with text area with only 2 rows & 10 cols.
On clicking/focus,the text area should be expanded.
The text areas only inside repeaters must be expanded, not others.
Thanks in Advance!
推荐答案
<asp:TextBox ID="txtUserName" onfocus="changesize(this);" runat="server" CssClass="txtwidth200" MaxLength="50"
TabIndex="1" TextMode="MultiLine" placeholder="Username"></asp:TextBox>
<pre lang="cs">function changesize(obj) {
(obj).attr(& #39; style&#39;,&#39; width:250px;身高:200像素;&安培;#39;);
} < / pre >
(obj).attr('style', 'width:250px; Height:200px;'); }</pre>
关注焦点的方法类似于缩小文本框
Similiar way on focus out you could shrink back the textbox
这段代码可以解决问题..
This code does the trick..
textarea:focus{
width: 250px;
position:absolute;
font-size:15px;
height:100px;
background-color: #E7FBF8;
outline: none;
-moz-box-shadow: inset 0 0 5px rgba(0,0,0,0.5);
-webkit-box-shadow: inset 0 0 5px rgba(0,0,0,0.5);
box-shadow: inset inset 0 0 5px rgba(0,0,0,0.5);
}
这篇关于如何在点击时扩展textarea?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文