Jump to content

how to diable a button when page is loaded


b_suneetha

Recommended Posts

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...