Convert lowercase letter to upper case in javascript

后端 未结 6 1781
温柔的废话
温柔的废话 2021-01-01 14:45

I have a code that will convert lower case letters to uppercase but it works only with IE and not in Crome or Firefox.

function ChangeToUpper()
  {         
         


        
6条回答
  •  难免孤独
    2021-01-01 15:18

    
    
    

    separate javascript from your HTML

    window.onload = function(){
            var textBx = document.getElementById ( "txt1" );
    
            textBx.onblur = function() {
                this.value = this.value.toUpperCase();
            };
        };
    
    
    

    If the textbox is inside a naming container then use something like this

    var textBx = document.getElementById ("<%= txt1.ClientID %>");
    
                textBx.onblur = function() {
                    this.value = this.value.toUpperCase();
                };)
    

提交回复
热议问题