b_suneetha Posted March 3, 2007 Share Posted March 3, 2007 hi friendz,can u tell me how to disable a button when page is loadedi mean by using onload????? Link to comment Share on other sites More sharing options...
abjitu Posted March 3, 2007 Share Posted March 3, 2007 add this code with relevant changes, at the end of the page.<script type="text/javascript">var buttonId= document.getElementById("give ButtonId here");buttonId.disabled = true;</script> Link to comment Share on other sites More sharing options...
Xenon Design Posted March 4, 2007 Share Posted March 4, 2007 That will work. But for a more 'fun' way to do it you could hide the button all together. Im not sure if this is what you want but ill write it anyway. <script type="text/javascript">function hideButton(){var obj= document.getElementById("obj ID");obj.style.display = "none";}function showButton(){var obj= document.getElementById("obj ID");obj.style.display = "block";}</script> The only reason why I would use my code is if it was for security reasons. If I 'didnt' want anyone to push it i would hide it. Because you can easily enable a disabled button with a simple Firefox add on, Web Developer Toolbar. A item that is 'display: none;' will not show on HTML source if its initially set on load (see below): <script type="text/javascript">function showButton(){var obj = document.getElementById('hideme');obj.style.display = "block";}</script><input type="button" id="hideme" style="display:none;" value="Hello!" /><input type="button" value="Show button" onclick="showButton()" /> That should work...i hope :)Soo yea...probably more info than you needed Link to comment Share on other sites More sharing options...
b_suneetha Posted March 6, 2007 Author Share Posted March 6, 2007 thanq u guys,,,, Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now