JavaScript Tutorial/String/toUpperCase

Материал из Web эксперт
Перейти к: навигация, поиск

Convert String to upper case

<html>
<head>
<title>Convert String to upper case</title>
<script type="text/javascript" language="javascript">
<!-- //
onload = function(){
    var s = new String("aaA");
    var upperCase = s.toUpperCase();
    document.write(upperCase);
}
// -->
</script>
</head>
<body>
</body>
</html>


string.toUpperCase()

The toUpperCase() method converts the characters to all uppercase values.



<html>
    <script language="JavaScript">
    <!--
    var myString = new String(prompt("Please enter some various case text", ""));
    document.write(myString.toUpperCase());
    document.close();
    -->
    </script>
</html>