View Full Version : parent function fires twice?!

Mar 30th, 2003, 05:36 PM
Using framesets, I'm calling a function in a parent frame. Here's the relevant code:

function save_input()

document.write('<FORM name="form1">');
document.write('<BR><INPUT type="button" name="b1" value="Submit" onClick="save_input()">');

This works, except every time the submit button is clicked, the function "next_question1" seems to fire twice.

Any ideas why?? Thanks.

Mr J
Mar 30th, 2003, 06:04 PM
I think you need to put the function call "onsubmit" rather than "onclick"

document.write('<FORM name="form1" onsubmit="save_input()">');
document.write('<BR><INPUT type="button" name="b1" value="Submit">');