Saturday 26 March 2016

Write a JavaScript program to perform case conversion?

Code:


<!DOCTYPE html>
<html>
<body>
<p>Click the button to convert the string to uppercase letter</p>
<button onclick="myfunction()">
    Try it
</button>
<p id="demo"></p>
<script>
    function myfunction()
    {
        var str=document.form.text.value;
        var res=str.toUpperCase();
        document.getElementById("demo").innerHTML=res;
    }
</script>
<form name="form">
<input type="text" name="text" value="">
</form>
</body>
</html>


Output:


No comments:

Post a Comment