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? Link to comment https://forums.phpfreaks.com/topic/153337-solved-help-with-calling-a-function-with-variables/ 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> Link to comment https://forums.phpfreaks.com/topic/153337-solved-help-with-calling-a-function-with-variables/#findComment-805721 Share on other sites More sharing options...
Darkmatter5 Posted April 9, 2009 Author Share Posted April 9, 2009 It worked thanks! Link to comment https://forums.phpfreaks.com/topic/153337-solved-help-with-calling-a-function-with-variables/#findComment-805800 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.