VALDATION IN JAVASCRIPT

 <!DOCTYPE html>

<html>

</html> 

<head>

    <title>

        Simple HTML webpage with CSS style

    </title>


<script>

function validation()

{

var name=document.form["regform"]["name"];

if(name.value==null||name.value=="")

{

 alert("name cant be blank");

 return false;

}

</script>

 

    <!-- Stylesheet of web page -->

    <style>

        body {

            text-align: center;

        }

 

        h1 {

            color: green;

        }

    </style>

</head>

 

<body>

    <h1><form name="regform" onsubmit="return validation()" method="post">

name:<input type="text" name="name">

<input type="submit">

</form></h1>

 

    <p>A computer science portal for geeks</p>

</body>

 

</html>

Comments

Popular posts from this blog

Swayamvar Program In Python