16 Create Employee Registration form also apply validation on required filled such as Mobile Number and submit it. After submitting the form, filled information will be displayed on that newly created child window.

Program:

<html>

        <head>

            <script>

               

                function Sub()

                {

                    var p=t2.value;

                    var patt=/\d{10}/;

                    if(p.match(patt))

                    {

                        var win = window.open("","childwindow","top=200,left=100,width=250,height=100,status");

                        win.document.writeln("Employee Name:"+t1.value+"<br/>"+"Mobile num:"+t2.value);

                    }

                    else{

                        alert("Mobile number is invalid");

                    }

                }

              

                </script>

        </head>

    <body>

        Employee Name:<input type="text" id="t1">

        Mobile No:<input type="text" id="t2">

        <input type="submit" value="Submit" onclick="Sub()">

       

    </body>

</html>



Output:

Previous
Next Post »