Program:
Output:
<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: