I have tried to make code for inbuild javascript function (touppercase).Does this helpfull or not? -
this code use inbuilt fuction of javascript touppercase shortformat benificial interview .sometimes need not use inbuilt functions ..so there code them.
//change lower case upper case function change_upper_case() { var a1 = [], a6 = [], = 0; // define variables a1 = document.getelementbyid('enterstring').value; //get value enter while(i < a1.length) { //check condition true or false var a2 = a1[i]; var a3 = a2.charcodeat(0); //get ascii value of char in number format var a5 = a2; if(a3 >= 97 && a3 < 123) { // = 97 , z=122 var a4 = a3-32; a5 = string.fromcharcode(a4); //change ascii value of a4 in char format } a6[i] = a5; i++; } document.getelementbyid('showstring').innerhtml = a6.join(''); //print input string on browser }
//change lower case upper case function change_upper_case() { var a1 = [], a6 = [], = 0; // define variables a1 = document.getelementbyid('enterstring').value; //get value enter while(i < a1.length) { //check condition true or false var a2 = a1[i]; var a3 = a2.charcodeat(0); //get ascii value of char in number format var a5 = a2; if(a3 >= 97 && a3 < 123) { // = 97 , z=122 var a4 = a3-32; a5 = string.fromcharcode(a4); //change ascii value of a4 in char format } a6[i] = a5; i++; } document.getelementbyid('showstring').innerhtml = a6.join(''); //print input string on browser }
<input type="text" id="enterstring"/> <input type="button" value="upper case" onclick="change_upper_case()"/> <span id="showstring"></span><br/>
javascript has touppercase function string types, take http://www.w3schools.com/jsref/jsref_touppercase.asp
Comments
Post a Comment