Related Posts Plugin for WordPress, Blogger...

About

Follow Us

Monday, 25 May 2015

Introduction: In this article I will explain how change first letter of the word to uppercase and Lowercase.
We can use jquery or javascript to complete this task.

Implementation:
Following Javascript will be used to convert to uppercase or lowercase:

For Uppercase:

<script type="text/javascript">
        function Uppercase(id) {
            var txt = document.getElementById(id);
            txt.value = txt.value.replace(/\w\S*/g, function (txt) { returntxt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase(); });
        }
    </script>


For Lowercase:

<script type="text/javascript">
        function Lowercase(id) {
            document.getElementById(id).value = document.getElementById(id).value.toLowerCase();
        }
    </script>

Design Section:
After placing Javascript in Head section, design you’re your webpage as given below:

<fieldset style="width:400px">
    <legend><strong> Convert TextBox Value to Uppercase Or Lowercase</strong></legend>
<div>
<table >
    <tr><td><b>Uppercase Example</b></td></tr>
    <tr><td>First Name:</td><td>
        <asp:TextBox ID="txtuppercase" runat="server" onkeyup="Uppercase(this.id)"></asp:TextBox></td></tr>
        <tr><td><b>Lowercase Example</b></td></tr>
        <tr><td>First Name:</td><td><asp:TextBox ID="txtlowercase" runat="server" onkeyup="Lowercase(this.id)"></asp:TextBox></td></tr>
    </table>
</div></fieldset>



Now run the project and check the result.
Categories: , ,

0 comments:

Post a Comment