JavaScript toUpperCase Letter Conversion Capitalization method

Source: Internet
Author: User
Tags alphanumeric characters

The toUpperCase () method is used to convert a string to uppercase.

Grammar
Stringobject.touppercase () return value
A new string in which all lowercase characters stringobject are converted to uppercase characters.

<script language= "JavaScript" >
<!--
var myString = new String (Prompt ("Please enter some various case text", ""));

document.write (Mystring.touppercase ());

Document.close ();

-->

</script>

Description
The toUpperCase function method in JavaScript has no effect on non-alphanumeric characters.

<title>convert String to Upper Case</title>
<script type= "text/web Effects" language= "JavaScript" >
<!--//
onload = function () {
var s = new String ("AAA Me");
var uppercase = S.touppercase ();
document.write (uppercase);
}
-->
</script>
<body>

</body>


Combine the above to see case conversion

Change your code to see if it fits your requirements.

<script language= "javascript"
function Loadsome () {
 var Text1 = document.getElementById (' textfield1 ');
 text1.focus ();
}
Function ToUpper () {
 document.getelementbyid (' textfield2 '). Value = document.getElementById (' Textfield1 '). Value.touppercase ();
}
Function ToLower () {
 document.getelementbyid ("Textfield4"). Value = document.getElementById (" Textfield3 "). Value.tolowercase ();
}

</script>
<title> case Conversion </title>
<body onload= "Loadsome ();"
<form action= "method=" ""
 <p>
  <input type= "text" id= "Textfield1"
  <input type= "button" name= "Submit" value= "small-large" onclick= "ToUpper" ();
  <input type= "text" id= "textfield2" value= ""
 </p>
 <p>
  <input type= "text" id= "textfield3"
  <input type= "button" Name= "Submit2" value= "big-small" onclick= " ToLower (); "
  <input type= "text" id= "Textfield4" value= ""
 </p>
</form>
</ Body>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.