javascript - Popup on form submission -


i display popup when signs 1 of websites. there data writing external database (this works correctly) bit unsure parts of code can change , need remain. if of able advise on great! bit of noob when comes javascript!

thanks in advance

<form name="signup" id="signup" action="http://creationonline.co.uk/signup.ashx" method="post" onsubmit="return validate_signup(this)"> <input type="hidden" name="addressbookid" value="1232079"> <!-- userid - required field, not remove --> <input type="hidden" name="userid" value="81918"> <!-- returnurl - when user hits submit, they'll sent here --> <input type="hidden" name="returnurl" value=""> <!-- email - user's email address --> <table border="0" cellpadding="0"> <tr> <td> sign </td><td><input name="email" type="text" placeholder="email address" size="29"></td> <td align="left"><input type="submit" name="submit" class="su_btn" value=">"></td> </tr>  </table> </form>`   <!-- function validate_signup(frm) {     var emailaddress = frm.email.value;     var errorstring = '';     if (emailaddress == '' || emailaddress.indexof('@') == -1) {         errorstring = 'please enter email address';     }   var els = frm.getelementsbytagname('input'); (var = 0; < els.length; i++) {     if (els[i].classname == 'text' || els[i].classname == 'date' || els[i].classname == 'number')     {         if (els[i].value == '')             errorstring = 'please complete required fields.';     }     else if (els[i].classname == 'radio')     {         var tocheck = document.getelementsbyname(els[i].name);         var radiochecked = false;         (var j = 0; j < tocheck.length; j++)         {             if (tocheck[j].name == els[i].name && tocheck[j].checked)                 radiochecked = true;         }         if (!radiochecked)             errorstring = 'please complete required fields.';     } }        var iserror = false;     if (errorstring.length > 0)         iserror = true;      if (iserror)         alert(errorstring);     return !iserror; }   //--> 

i'm not sure if understand question, u can remove javascript code , 'll stil work fine.

all grey part see here on stackoverflow, can remove.

to popupm u'll need change action return something, , you'll need yo use ajax return , send popup without reload page.

i recomend use jquery ajax, it's little bit easier.

see more on: http://api.jquery.com/jquery.ajax/

and pop can use simple alert function or use jquery ui more beauty function http://jqueryui.com/dialog/


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -