javascript - How to create input form which opens an alert box? -



javascript - How to create input form which opens an alert box? -

in html have created form input text, using javascript validation, should able see below.

i want create when submit button clicked alert box appears thanking user inputting data.

i can't seem without ruining js validation.

does know how accomplish this?

any help appreciated.

thank you.

class="snippet-code-js lang-js prettyprint-override"> function validateform() { var x = document.forms["myform"]["name"].value; if (x == null || x == "") { alert("please come in name"); homecoming false; } var x = document.forms["myform"]["email"].value; if (x == null || x == "") { alert("please come in valid email address"); homecoming false; } var x = document.forms["myform"]["confirm"].value; if (x == null || x == "") { alert("please select option"); homecoming false; } } class="snippet-code-css lang-css prettyprint-override"> h1 { background-color: silver; color: black; font-size: 1.2em; font-family: arial, verdana, sans-serif; } hr { color: blue; width: thick; } body { font-size: 12pt; color: brown; font-family: tahoma, bodoni, sans-serif; line-height: 0.8em; } class="snippet-code-html lang-html prettyprint-override"><html> <head> <title>basic form markup</title> <meta charset="uft-8" /> <script> </script> </head> <body> <h1>multi-part form</h1> <hr /> <div> <form name="myform" action+ "demo_form.asp" onsubmit="return validateform()" method="post"> <h1>name , e-mail</h1> <p>name: <input id="name" type="text" name="name" size="30" maxlength="250"> </p> <p>e-mail: <input type="text" name="email" size="30" maxlength="50"> </p> <p>comments or questions (optional)</p> <textarea name="address" rows=3 cols=80></textarea> <h1>do wish receive regular emails giving info gcenterpise's ongoing projects?</h1> <!--maybe alter above paragraph tag?--> <p> <input type="radio" name="confirm" value="yes">yes</p> <p> <input type="radio" name="confirm" value="no">no</p> <p style="line-height: 2em; margin: 2em;"> <input type="submit" value="send"> <input type="reset" value="clear"> </p> </div> <hr/> </body> </html>

i don't getting meant without ruining js validation. can add together little statement @ end of js validation script

alert('thanks data')

javascript css forms validation

Comments

Popular posts from this blog

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -