使用 Text 增加文本框大小 [英] Increase textbox size with Text

查看:26
本文介绍了使用 Text 增加文本框大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道如何谷歌这个,它总是想出我不想要的答案.所以,我有一个文本框,我想要它有一个设定的大小,但是如果文本大于大小,那么我希望文本框的大小随着文本的增加而增加.

I didn't know how to Google this, it always came up with answers I wasn't looking for. So, I have a textbox, I want it so that it has a set size BUT if the text is larger than the size then I want the textboxes size to increase with the Text.

令人困惑吗?我不太擅长解释这些东西.

Confusing Right? I'm not too good at explaining this stuff.

新部分:文本框预装了此文本,但提供的答案仅在输入时有效.我在文本框中找不到 onload,那现在怎么办?

New Part: The textbox comes preloaded with this text, but the answers provided only work as they are typing. I can't find onload on the textbox, so what now?

推荐答案

这对我有用:
http://www.codingforums.com/showthread.php?t=54130

也在窗口加载时运行它(此示例适用于 asp .net 页面):

Also run it on window load (this example is for an asp .net page):

<script type="text/javascript" language="JavaScript" src="../../javascript/Utility.js">
</script>

<script type="text/javascript" >
    window.onload = Init;

    function Init()
    {
      ResizeTextarea(document.getElementById("<%=tbDetails.ClientID%>"));
    }
</script>

这篇关于使用 Text 增加文本框大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆