S
Super Steve
I'm trying to write a little script that disables the submit button on
a form, changes the text of the button, and then submits the form.
Can anyone tell me why this works ok:
<input type="button" value="Submit" onClick="this.disabled=true;
this.value = 'Submitting...'; this.form.submit();">
But when I try to make a function it doesn't work:
<script language="JavaScript">
function DisableButton(b) {
b.disabled = true;
b.value = 'Submitting...';
b.form.submit();
}
</script>
<input type="button" value="Submit" name="submit"
onClick="DisableButton(this);">
When I try this the button text is changed and the button is disabled,
but the form doesn't submit. In IE I get an error that points to the
line that says:
b.form.submit();
and the error:
Object doesn't support this property or method
What's the difference between doing this code directly in the onClick
event and doing it in a function?
a form, changes the text of the button, and then submits the form.
Can anyone tell me why this works ok:
<input type="button" value="Submit" onClick="this.disabled=true;
this.value = 'Submitting...'; this.form.submit();">
But when I try to make a function it doesn't work:
<script language="JavaScript">
function DisableButton(b) {
b.disabled = true;
b.value = 'Submitting...';
b.form.submit();
}
</script>
<input type="button" value="Submit" name="submit"
onClick="DisableButton(this);">
When I try this the button text is changed and the button is disabled,
but the form doesn't submit. In IE I get an error that points to the
line that says:
b.form.submit();
and the error:
Object doesn't support this property or method
What's the difference between doing this code directly in the onClick
event and doing it in a function?