News
* IBM to offer mobile security as a service IBM will start delivering mobile security-as-a-service (MaaS) through its own cloud infrastructure in India, a move that is expected to better address in-country data requirements... IBM Spectrum Computing: IBM has enlarged its portfolio of software-defined infrastructure solutions with cognitive features for workload management.  * LiFi internet technology has been introduced, the new type of wireless internet connection that gives 100 times faster than traditional WiFi -- Invented by Professor Harald Haas from the University of Edinburgh. * Sci. Rachid Yazami has developed a smart chip that charges smartphones in less than 10 minutes. BenQ has launched BlueCore projector - Consumer electronics major BenQ has launched its first BlueCore laser light source projector. For those unaware, devices with BlueCore laser technology have a high contrast output of 80000:1 with an extended lamp life and efficiency. *** 
  Nov 23 2014 5:21AM     John
  11 Comments    42676 Views  
Here John discussed about Login form Validation in javascript.
Java Script is dynamic and most commonly used in all programming languages.
Java Script code should be enclosed with in Script Tags
Ex :

<script type="text/javascript"></script>

JavaScript

<script language = "JavaScript">
        function validate() {
            var username = document.getElementById("username").value;
            var password = document.getElementById("password").value;
            if (username == null || username == "") {
                alert("Please enter the username.");
                return false;
            }
            if (password == null || password == "") {
                alert("Please enter the password.");
                return false;
            }
            alert('Login successful');
            
        } 
</script>

Html

<html>
<body>
<form id="form1" runat="server">
    <div class="container">
        <div class="main">
            <h2>
                Javascript Login Form Validation</h2>
            <form id="form_id" method="post" name="myform">
            <label>
                User Name :</label>
            <input type="text" name="username" id="username" />
            <br><br>
            <label>
                Password :</label>
            <input type="password" name="password" id="password" />
            <input type="button" value="Login" id="submit" onclick="validate();" />
            </form>
        </div>
    </div>
    </form>
</html>
</body>

Page Design
I hope this page will helps you to validate any kind of forms using Javascript.Thanks.
BackToTop
Comments


AnonymousUser
Aug 16 2018 12:37PM
nice explanation
AnonymousUser
Oct 15 2018 7:20PM
I love reading through your internet site. Appreciate it!
AnonymousUser
Oct 17 2018 5:03AM
Thank you! It a fantastic web page!
AnonymousUser
Oct 7 2018 10:19PM
You've among the finest internet sites.
AnonymousUser
Oct 19 2018 11:29AM
Keep up the excellent work and delivering in the group!
AnonymousUser
Oct 17 2018 5:50AM
Thank you! It a fantastic web page!
AnonymousUser
Oct 29 2018 11:41AM
love it
AnonymousUser
Nov 13 2018 5:28AM
Nice
AnonymousUser
Oct 15 2019 3:13AM
thanks so much very useful easily understand at beginners level plz upload the more validation other type
AnonymousUser
Nov 15 2019 3:43PM
Great! Works for me
AnonymousUser
Nov 27 2019 10:44AM
Great! Works for me

 
Search
Recent Posts
Create Amazon ElasticCache Using Memcached in CSharp
Oct 29 2018 12:09PM Posted By Amose
Get Google Map Lat Lng (Geo Point) By Pincode in C#
Oct 28 2018 12:09PM Posted By Pranav
Google URL Shortener in C#
Oct 20 2018 12:09PM Posted By Sanjay
Bind Gridview from CSV file in Asp.Net C#
Oct 5 2018 12:09PM Posted By Michael
Call WebService method from jQuery in every 1 minute
Sep 26 2018 12:09PM Posted By John
Gridview custom CSS in ASP.Net
Sep 14 2018 12:09PM Posted By Micheal Ryan
Read excel file and bind to Gridview in C#
Sep 10 2018 12:09PM Posted By Micheal
Tags
Follow us on Facebook
Follow us on Google +
Recent post in your Email inbox.
Enter your email address: