I have email form created with the javascript validation already coded. When I click on the submit button no alert boxes pop to warn me I dont have the fields entered. Can anybody help me to get the JS to take action when the submit button is clicked?
here is the page of code including the JS and email form:
Thanks a lot for your helpCode:<html> <head> <script type="text/javascript" language="JavaScript"> //validating email address re = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/ function submitit(myform) { if (re.test(myform.emailaddr.value)) { return true } alert("invalid email address") myform.emailaddr.focus( ) myform.emailaddr.select( ) return false } function validform(emailaddrform) { if (emailaddrform.emailaddr1.value == "") { alert("You must enter an email address") emailaddrform.emailaddr1.focus( ) return false } if (emailform.emailaddr1.value ! = emailform.emailaddr2.value) { alert("Entered email addresses did not match") emailform.emailaddr1.focus( ) emailform.emailaddr1.select( ) return false } return true } </script> </head> <body> <table border="1" width="100%"> <tr> <td width="10%"> <map name="homeleft" id="homeleft" align="left"> <area shape="rect" coords="10, 10, 212, 219" href="index.html"/> <area shape="rect" coords="66, 253, 168, 303" href="realestatepost.html"/> <area shape="rect" coords="66, 342, 168, 391" href="graphics.html"/> </map> <img src="http://i95.photobucket.com/albums/l136/surreal5335/web%20builder/homeleft.png" usemap="#homeleft" id="homeleft" hspace="10" vspace="10" align="center"><br> </td> <td width="80%"> <!--home content--!> <img src="http://i95.photobucket.com/albums/l136/surreal5335/web%20builder/portfolioheader.png" hspace="10" vspace="10" align="center"><br/><br> <form method="post" name="emailform" action="emailform.php"> <p class="legend">Contact via email</p> <fieldset id="conact"> <label>Name: </label><input type="text" name="name" size="30"/><br/> <br> <label>Email: </label><input type="text" name="emailaddr1" size="30"/><br/> <br> <label>Email: </label><input type="text" name="emailaddr2" size="30"/><br/> <br> <label>Phone: </label><input type="text" name="phone" size="30"/><br/> <br> <label>Comments: </label><br><textarea name="comments" rows="10" cols="30">Please give me a brief description of the work you need done</textarea><br/> <br> <input type="submit" name="submit"><a href="thankyou.html"></a></button><br/> </td> <td width="10%"> <map name="homeright" id="homeright" align="left"> <area shape="rect" coords="37, 530, 191, 683" href="contact.html"/> </map> <img src="http://i95.photobucket.com/albums/l136/surreal5335/web%20builder/homeright.png" usemap="#homeright" id="homeright" hspace="10" vspace="10" align="center"><br> </td> </tr> </body> </table> </html>


LinkBack URL
About LinkBacks
Reply With Quote

