i can't do this form, the button will be disabled when page load and only be enabled when one tick in the checkbox ( if the checkbox is unticked , the button will be disabled again). anyone help me ? thanks
austin-khoi
0
Newbie Poster
Recommended Answers
Jump to Post<html> <head> <script type="text/javascript"> function enableButton() { if(document.getElementById('option').checked){ document.getElementById('edit').disabled=''; } else { document.getElementById('edit').disabled='true'; } } </script> </head> <body onload="enableButton();"> <form method="post" action="test5.php"> <input type="checkbox" name="option" id="option" onclick="javascript:enableButton();">Enable<br> <input type="button" name="button" value="Edit" id="edit"> </form> </body> </html>
Cheers,
Naveen
Jump to PostHi! Welcome to Daniweb.. Is this what you want ?
<html> <head> <script type="text/javascript"> function enableButton() { if(document.getElementById('option').checked){ document.getElementById('b1').disabled=''; } else { document.getElementById('b1').disabled='true'; } } </script> </head> <body onload="enableButton();"> <form method="post"> <input type="checkbox" name="option" id="option" onclick="javascript:enableButton();">Enable<br> <input type="button" name="b1" value="Click" id="b1" onclick=location.replace('
Jump to Post<input type="button" name="b1" value="Click" id="b1" onclick="top.location.replace('http://www.google.com');" />
Jump to Post<script type="text/javascript"> function enableButton() { if(document.getElementById('option').checked='checked'){ document.getElementById('b1').disabled=""; } else { document.getElementById('b1').disabled='disabled'; } } </script> <p style='text-align:center;'> <span style='float:right;text-align:right;'> <input type="checkbox" name="option" id="option" onclick="javascript:enableButton();"> <label for='option'> I have read and agree to the<br />terms and conditions </label> </span> <input type="button" name="b1" value="Click" id="b1" disabled='disabled' onclick="top.location.replace('
All 13 Replies
nav33n
472
Purple hazed!
Team Colleague
Featured Poster
Mahesh_J
0
Newbie Poster
Dasjetta
0
Newbie Poster
nav33n
472
Purple hazed!
Team Colleague
Featured Poster
darkagn
commented:
Excellent suggestion.
+6
Dasjetta
0
Newbie Poster
Dasjetta
0
Newbie Poster
nav33n
472
Purple hazed!
Team Colleague
Featured Poster
almostbob
866
Retired: passive income ROCKS
Dasjetta
0
Newbie Poster
almostbob
866
Retired: passive income ROCKS
Dasjetta
0
Newbie Poster
almostbob
866
Retired: passive income ROCKS
Dasjetta
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.