Darkmatter5 Posted April 9, 2009 Share Posted April 9, 2009 I have this code: <div><input type="password" size="25" name="password"></div> <div><input type="password" size="25" name="conf_password" onchange="comp_password(this.value,password)"> <span id="password_compare"></span></div> I need to pass the value of password to this function. How can I do this? I know "comp_password(this.value,password)" isn't corrent, so what do I put here "comp_password(this.value,password)" to make this work? Quote Link to comment Share on other sites More sharing options...
Axeia Posted April 9, 2009 Share Posted April 9, 2009 Hold on, You want to send the value of the password and conf_password named fields to the conf_password function? If so, for ease of use add an ID tag to the first password word field, like this: <div><input type="password" size="25" id="password" name="password"></div> now we can call for the value of that field by using document.getElementById( 'password' ).value, so adept the second line to: <div><input type="password" size="25" name="conf_password" onchange="comp_password(this.value, document.getElementById( 'password' ).value)"> <span id="password_compare"></span></div> Quote Link to comment Share on other sites More sharing options...
Darkmatter5 Posted April 9, 2009 Author Share Posted April 9, 2009 It worked thanks! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.