Allora io ho questo codice che serve per la registrazione. Quindi, grazie ad un utente del forum, sono riuscito piommeno a capire come realizzare questo effetto http://forum.html.it/forum/showthrea...readid=1477600
ora vorrei modificare questo codice, le variabili ecccodice:<html> <head> <script type="text/javascript" src="verifypassword.js"></script> <script type="text/javascript" src="verifyemail.js"></script> <title>Modulo di registrazione</title> </head> <body> <div align="center"> <form action="register.php" method="post" name="registrazione_form"> <table border="0" width="800"> <tr> <td>Username:</td> <td><input type="text" name="username"></td> <td></td> </tr> <tr> <td>Password:</td> <td><input type="password" name="password1" onkeyup="verify.check()"></td> <td></td> </tr> <tr> <td>Repeat-Password:</td> <td><input type="password" name="password2" onkeyup="verify.check()"></td> <td><div id="password_result"></div></td> </tr> <tr> <td>Mail:</td> <td><input type="text" name="mail" onkeyup="verify.checkm()"></td> <td></td> </tr> <tr> <td>Repeat-Mail:</td> <td><input type="text" name="mail2" onkeyup="verify.checkm()"></td> <td><div id="email_result"></div></td> </tr> <tr> <td colspan="2" align="center"><input type="submit" name="action" value="Invia"></td> <td></td> </tr> </table> </div> </form> </body> </html>
in modo da utilizzarlo, oltre per il campo password/repeatpassword, anche per il campo email/repeatemail. Essendo poco esperto del javascript vi chiedo aiuto.. è tutto il giorno che ci provo ma niente.. il mio livello di javascript è ancora bassocodice:function verifynotify(field1, field2, result_id, match_html, nomatch_html) { this.field1 = field1; this.field2 = field2; this.result_id = result_id; this.match_html = match_html; this.nomatch_html = nomatch_html; this.check = function() { // Make sure we don't cause an error // for browsers that do not support getElementById if (!this.result_id) { return false; } if (!document.getElementById){ return false; } r = document.getElementById(this.result_id); if (!r){ return false; } if (this.field1.value != "" && this.field1.value == this.field2.value) { r.innerHTML = this.match_html; } else { r.innerHTML = this.nomatch_html; } } } function verifyInput() { verify = new verifynotify(); verify.field1 = document.registrazione_form.password1; verify.field2 = document.registrazione_form.password2; verify.result_id = "password_result"; verify.match_html = "<span style=\"color:blue\">Grazie, la password corrisponde!<\/span>"; verify.nomatch_html = "<span style=\"color:red\">Inserisci nel secondo campo la stessa password del primo.<\/span>"; // Update the result message verify.check(); } // Multiple onload function function addLoadEvent(func) { var oldonload = window.onload; if (typeof window.onload != 'function') { window.onload = func; } else { window.onload = function() { if (oldonload) { oldonload(); } func(); } } } addLoadEvent(function() { verifyInput(); });

					
					
					
						
  Rispondi quotando