How do I disable a button in frontpage?

kimberlys777
kimberlys777 used Ask the Experts™
on
I have a hyperlinked button on a form in frontpage.  I want it to be hidden or disabled until a checkbox is selected.  I want it to function like the pages where you have to agree to some terms and conditions before you're able to click on another button.  The code for the button is attached (the checkbox hasn't been made yet)  My code is attached
<a href=www.mypage.com>
     <img border="0" id="img1" src="button2.jpg" height="20" width="80" alt="YES"  onmouseover="FP_swapImg(1,0,/*id*/'img1',/*url*/'button3.jpg')" onmouseout="FP_swapImg(0,0,/*id*/'img1',/*url*/'button2.jpg')" onmousedown="FP_swapImg(1,0,/*id*/'img1',/*url*/'button4.jpg')" onmouseup="FP_swapImg(0,0,/*id*/'img1',/*url*/'button3.jpg')" fp-style="fp-btn: Glow Rectangle 8; fp-proportional: 0" fp-title="YES"></a>

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Senior Web Developer
Commented:
<html>
<head>
<title>Example</title>
<script type="text/javascript">
function theChecker()
{
if(document.theForm.theCheck.checked==false)
{
document.theForm.theButton.disabled=true;
}
else
{
document.theForm.theButton.disabled=false;
}
}
</script>
</head>
<body onload="document.theForm.theButton.disabled=true">
<form name="theForm" action="#" method="post">
<input type="checkbox" name="theCheck" onclick="theChecker()" value="">I agree to the terms of use.
<input type="submit" name="theButton" value="Submit">
</form>
</body>
</html>

Open in new window

Author

Commented:
Perfect!  Thanks for the quick response!!

Commented:
<html>
 <head></head>

 <body>
  <div> Toggle  <input type = "checkbox" onclick = "document.getElementById('a_lnk').style.display=(this.checked?'':'none');"
	   checked = "checked" />
  </div>

  <a href = "www.mypage.com" id = "a_lnk">
  <img border = "0" id = "img1" src = "button2.jpg" height = "20" width = "80" alt = "YES"
	  onmouseover = "FP_swapImg(1,0,/*id*/'img1',/*url*/'button3.jpg')"
	  onmouseout = "FP_swapImg(0,0,/*id*/'img1',/*url*/'button2.jpg')"
	  onmousedown = "FP_swapImg(1,0,/*id*/'img1',/*url*/'button4.jpg')"
	  onmouseup = "FP_swapImg(0,0,/*id*/'img1',/*url*/'button3.jpg')"
	  fp-style = "fp-btn: Glow Rectangle 8; fp-proportional: 0" fp-title = "YES"></a>
 </body>
</html>

Open in new window

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial