DarkPrince2005 Posted December 5, 2009 Share Posted December 5, 2009 Can someone please tell me where I'm going wrong? Noting seems to work.... <html> <head><title></title> <script type="text/javascript" language="javascript"> function online(){ if(document.respond.online_response.checked) { document.respond.response.disabled = false; } else{ document.respond.response.disabled = true; } </script> </head> <body> <form name="respond"> <input type="checkbox" name="online_response" id="online_response" onclick="online()" /> <input type="text" name="response" id="response" disabled /> </form> </body></html> Quote Link to comment https://forums.phpfreaks.com/topic/184103-stupid-disableenable-problem/ Share on other sites More sharing options...
Zane Posted December 5, 2009 Share Posted December 5, 2009 You're missing the closing bracket for your online function function online(){ if(document.respond.online_response.checked) { document.respond.response.disabled = false; } else{ document.respond.response.disabled = true; } } /* A cleaner way of doing this would be this though. function online() { document.respond.response.disabled = (document.respond.online_response.checked) ? false : true; } Quote Link to comment https://forums.phpfreaks.com/topic/184103-stupid-disableenable-problem/#findComment-971965 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.