Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <script type="text/javascript">
- <!--
- function validateForm()
- {
- var x=document.forms["myForm"]["fname"].value;
- if (x==null || x=="")
- {
- alert("First name must be filled out");
- return false;
- }
- }
- //-->
- </script>
- <title>JavaScript validation demo</title>
- </head>
- <body>
- <form name="myForm" action="demo_form.asp" onsubmit="return validateForm()" method="post" id="myForm">
- First name: <input type="text" name="fname" /><input type="submit" value="Submit" />
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment