SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Hybrid View

  1. #1
    SitePoint Enthusiast Dunkel's Avatar
    Join Date
    Jun 2007
    Location
    Mexico
    Posts
    59
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Convert to UpperCase while Typing

    Hello everyone, now I post a little function which will help you to convert lowerCase to UpperCase while you are typing.

    Code:
    <script language="javascript" type="text/javascript">
    function pulsar(e,obj) {
      tecla = (document.all) ? e.keyCode : e.which;
      //alert(tecla);
      if (tecla!="8" && tecla!="0"){
      	obj.value += String.fromCharCode(tecla).toUpperCase();
      	return false;
      }else{
      	return true;
      }
    } 
    </script>
    <input type="text" onkeypress="return pulsar(event,this)" />
    If you could help me to improve this function your advice is very welcome

    I hope this will be helpful for someone

  2. #2
    SitePoint Addict CommanderZ's Avatar
    Join Date
    Apr 2006
    Location
    Czech Republic
    Posts
    236
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code HTML:
    <script language="javascript" type="text/javascript">
    function pulsar(object) {
      object.value=this.value.toUpperCase();
    } 
    </script>
    <input type="text" onkeypress="pulsar(this)" />
    --not tested--

  3. #3
    SitePoint Addict
    Join Date
    Aug 2006
    Posts
    266
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
     
    <script language="javascript" type="text/javascript">
    function pulsar(obj) {
      obj.value=obj.value.toUpperCase();
    }
    </script>
    <input type="text" onkeyup="pulsar(this)" />

  4. #4
    SitePoint Enthusiast Dunkel's Avatar
    Join Date
    Jun 2007
    Location
    Mexico
    Posts
    59
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks for the advice I will check all that recommendations


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •