| | |||||
| ||||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | THREAD STARTER #1 (permalink) |
| New Member Join Date: Jun 2004 Location: Devon, England
Posts: 3
![]() | Enabling Disabled Buttons in JS Hi, I don't know javascript so here goes. I've created a drop down menu and when a user selects a certain option and clicks the submit button a load of information is printed about the option (in PHP). I have a disabled button called 'button' lol and I want it to be enabled when a user clicks a certain option in the drop downlist. I tried button.disabled=false as a random guess but as I said I don't know JS lol. Worth a try. If you can help that'd be great! Thanks! Dan G!bbs
__________________ <? $codename = $_POST["Codename: Up The Irons"]; ?> |
| |
| | #4 (permalink) |
| NamePros Member Join Date: Jul 2004 Location: Clackamas, OR
Posts: 75
![]() | Haha I suppose it's too late, but I played with this for a few minutes and got this. Script: function dis() { var nah = document.frm.sel.value; if(nah == "true"){ document.frm.lol.disabled = true; } if(nah == "false"){ document.frm.lol.disabled = false; } } form: ????: NamePros.com http://www.namepros.com/programming/33845-enabling-disabled-buttons-in-javascript.html <form name="frm"> <select name="sel" onChange="dis()"> <option> - </option> <option value="false">Enable</option> <option value="true">Disable</option> </select> <br /><br /> <input type="button" name="lol" value="Hello" onClick="alert('hello');"> </form>
__________________ http://www.johnkerry.com/onlinehq/ Help anyway you can! http://therustybarrel.com/david/blog - My Blog http://therustybarrel.com/david/images/sig.jpg - My signature |
| |