Click to See Complete Forum and Search --> : can someone modify this script?....


xataku_nakusute
07-28-2003, 12:20 AM
<html>
<body onload="dis()">
<script type="text/javascript">
function tos()
{
document.f1.i1.disabled=false;
}
</script>
<script type="text/javascript">
function dis()
{
document.f1.i1.disabled=true;
}
</script>
<form name="f1">
<input type="checkbox" name="en" onclick="tos()"> Agree to Terms of

Sevrice
<input type="button" name="i1" value="Submit">
</form>
</body>
</html>

how can i modify this so that when the checkbox is checked, the button is enabled and when unchecked, disabled?

Exuro
07-28-2003, 01:20 AM
Try this:

<html>
<body>
<script type="text/javascript">
function toggle()
{
document.f1.i1.disabled = !document.f1.en.checked;
}
</script>
<form name="f1">
<input type="checkbox" name="en" onclick="toggle()"> Agree to Terms of Sevrice
<input type="button" name="i1" value="Submit" disabled="disabled">
</form>
</body>
</html>