Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

Q1509 How can I disable and enable a form button?

You are here: irt.org | FAQ | JavaScript | Form | Q1509 [ previous next ]

Try the following in an HTML 4.x browser:

<form name="myForm">
<input type="button" name="myButton" onClick="if (!this.disabled) someFunction()">
<input type="submit" name="mySubmit" onClick="return (!this.disabled)">
</form>

<script language="JavaScript"><!--
document.myForm.myButton.disabled=true;
document.myForm.mySubmit.disabled=true;
//--></script>

©2018 Martin Webb