phpSensei Posted August 15, 2007 Share Posted August 15, 2007 I have a form where user's can upload an image. You can chose to input the width, height of the image yourself, but I want a checkbox when its check that those two fields are disabled. Checkbox= Resize Automatically Width= height= So If the check box is not checked, you can type in the two width and height fields, but when it is checked, they become disabled. hope you understand.. Quote Link to comment Share on other sites More sharing options...
Daniel0 Posted August 15, 2007 Share Posted August 15, 2007 <script type="text/javascript"> function toggle_size_fields() { height_obj = document.getElementById('height') width_obj = document.getElementById('width') if(height_obj.disabled == true) { height_obj.disabled = false } else { height_obj.disabled = true } if(width_obj.disabled == true) { width_obj.disabled = false } else { width_obj.disabled = true } } </script> <form> <label><input type='checkbox' name='resize_auto' onclick='toggle_size_fields()' /> Resize automatically?</label><br /> <label>Width: <input type='text' name='width' id='width' /><br /> <label>Height: <input type='text' name='height' id='height' /><br /> </form> Quote Link to comment 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.