| | |
check box enable button
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
php Syntax (Toggle Plain Text)
<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
Ignorance is definitely not bliss!
*PM asking for help will be ignored*
*PM asking for help will be ignored*
•
•
Join Date: Sep 2009
Posts: 6
Reputation:
Solved Threads: 0
•
•
•
•
php Syntax (Toggle Plain Text)
<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
I'm new to this site and I know absolutely nothing about writing script of any kind. I am building a website using iWeb and I need to to be able to create a button on my webpage exactly like the one above. How do I make the button click go to a URL? For example I want this button to activate when the check mark is added and then when the actual button is clicked I want it to take my visitor to a link of my choice.
Thank you....
Jay
Hi! Welcome to Daniweb.. Is this what you want ?
php Syntax (Toggle Plain Text)
<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('http://www.google.com') /> </form> </body> </html>
Ignorance is definitely not bliss!
*PM asking for help will be ignored*
*PM asking for help will be ignored*
•
•
Join Date: Sep 2009
Posts: 6
Reputation:
Solved Threads: 0
•
•
•
•
Hi! Welcome to Daniweb.. Is this what you want ?
php Syntax (Toggle Plain Text)
<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('http://www.google.com') /> </form> </body> </html>
I would also like to be able to format it a little. I want to be able to place the check box on the right and be able to either center the "Click" button or position it on the left.
Thank you so much for the help....
Jay
•
•
•
•
We are getting close. When I put this code in my site and run it from the webpage it doesn't work properly. What happens is it opens google.com in a very tiny window where the "Click" button was. I don't want a pop up window but rather have it load google.com full size in the current window.
•
•
•
•
I don't know if this makes a difference but I'm inserting the code as a Widget in iWeb 09.
If you post your relevant code, maybe someone who has experience on iweb 09 can help you out!
Ignorance is definitely not bliss!
*PM asking for help will be ignored*
*PM asking for help will be ignored*
html Syntax (Toggle Plain Text)
<input type="button" name="b1" value="Click" id="b1" onclick="top.location.replace('http://www.google.com');" />
Last edited by almostbob; Sep 16th, 2009 at 7:08 am.
Failure is not an option It's included free, you don't have to do anything to get it
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it
Please mark solved problems, solved
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it
Please mark solved problems, solved
•
•
Join Date: Sep 2009
Posts: 6
Reputation:
Solved Threads: 0
•
•
•
•
html Syntax (Toggle Plain Text)
<input type="button" name="b1" value="Click" id="b1" onclick="top.location.replace('http://www.google.com');" />
That did the trick. Is there any way to format this within the Widget window? For instance I want to be able to center the button and put the check box to the right side in the box.Also, it is possible to make a description word such as ENABLE for the check box to be a hyper link?
My intent for this little gem is to use it as a way to verify that a customer has read and agrees to my legal terms and condition before being able to order the product. The hyperlink will take then to the terms and conditions page.
To see an example of this code in use see my page http://www.holiday-scooters.com/HSR/...hair_Info.html
Last edited by Dasjetta; Sep 16th, 2009 at 7:46 am.
![]() |
Similar Threads
- cannot find server or DNS error (Web Browsers)
- System 32 box showing up at startup (Viruses, Spyware and other Nasties)
- System 32 at startup and "dwn"/"down" pop up at startup (Viruses, Spyware and other Nasties)
- Hijack IE (Viruses, Spyware and other Nasties)
- startpage.4.ao browser hijacker / would like it out my system (Viruses, Spyware and other Nasties)
- weird virus, plz help? (Viruses, Spyware and other Nasties)
- Possibly caught an irc virus. (Viruses, Spyware and other Nasties)
- Manually Put Your Computer into Hibernation (Windows tips 'n' tweaks)
- Use Hibernate and Standby to Conserve Batteries (Windows tips 'n' tweaks)
- Set Accessibility Features for People Who are Blind or Who Have Low Vision in WinXP (Windows tips 'n' tweaks)
Other Threads in the PHP Forum
- Previous Thread: Need help
- Next Thread: Need Help in sending n receiving verification email
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access ajax apache api array back beginner binary broken cakephp checkbox class cms code cron curl database date directory display download dynamic echo email error file files filter folder form forms function functions gc_maxlifetime google host href htaccess html image include insert integration ip java javascript joomla limit link login loop mail memmory memory menu mlm mod_rewrite multiple mysql navigation oop parse parsing paypal pdf php problem query radio random recursion regex remote script search server sessions sms snippet soap source space sql structure syntax system table thesishelp tutorial update upload url validation validator variable video web xml youtube






