[Javascript] Disabling submit button

Tim Makins spindrift at oceanfree.net
Fri Nov 12 06:59:39 CST 2004


----- Original Message ----- 
From: "Scott Hamm" <ScottHam at clientlogic.com>
To: "[JavaScript List] (E-mail)" <javascript at LaTech.edu>; "WebDesign-L
(E-mail)" <list at webdesign-L.com>
Sent: Friday, November 12, 2004 12:45 PM
Subject: [Javascript] Disabling submit button


> My goal: To disable submit button and to enable "preview" button while
user
> is editing in <textarea> box.  How do I get around to that?  I've looked
in
> dynamicdrive, it works mostly for IE only. :(
>
>
> Scott

Try this: Tim in Irealnd.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head>
<title></title>
<meta content="text/html; charset=windows-1252" http-equiv=Content-Type>
</head>
<body>
<script language="javascript">
function f2()
 {
  if(document.f1.chk1.checked)
     document.f1.Accept.disabled=false;
  else
     document.f1.Accept.disabled=true;
 }
</script>
</head>
<body>
How to disable a submit button until a box is checked
<p>
<form name="f1" action='downloads.jsp' method="post">
<input type="checkbox" name="chk1" value="yes" onClick="f2()">
<b>I have read and agree to the terms and conditions of use</b>
<p>
<input type="submit" name="Accept" value="Accept" disabled="true">
</form>
</body>
</html>




More information about the Javascript mailing list