七色彩虹

勤奋、务实、团结、创新

导航

转换文本小写字母to大写

Posted on 2010-09-30 14:26  aadfe  阅读(287)  评论(0编辑  收藏  举报

前台代码:

(html)

<asp:TextBox ID="TextBox1" runat="server" onkeyup="test();"></asp:TextBox>

(javascript)

<script type="text/javascript">
        function test()
        {
            var s = document.getElementById("TextBox1").value;
            if( s != null && typeof(s) != "undefined")
            {
                document.getElementById("TextBox1").value = s.toUpperCase();
            }
        }
       
    </script>

(c#)

public void r(ref object[] objs)
{
       for (int i = 0; i < objs.Length; i++)
       {
             if (typeof(string).IsInstanceOfType(objs[i]))
              {
                   objs[i] = objs[i].ToString().Trim().ToUpper();
              }
        }
}