...

View Full Version : Enabling disable butons



kaihirst
08-19-2005, 09:25 PM
Hi guys 'n' gals,

been really busy and not had chance to peek in. HAve question though.

Have a button that needs to be enabled when server side scripting builds and populates a dynamic array, so will be written to teh client by the server. anyways.

Bit of a dead end as the Enabled/Disable are not named attributes, they are arbritrary, so any ideas on how to enable them using client side script?

ideas,code or pointers would be greatly apprecieted.

ta

kai :thumbsup:

Ultragames
08-20-2005, 07:13 AM
<form>
<input type='button' id='MyButton' disabled>
</form>


<script>
function Disable(){
document.getElementByID('MyButton').disabled = false;
}
</script>

Then just run the function however fits your needs.

glenngv
08-22-2005, 01:04 PM
You can also enable the button in the server-side by not including the disabled property in the input tag. Have a variable that contains the string "disabled" or "" based on some conditions.

mrruben5
08-22-2005, 04:57 PM
<script type="text/javascript">
function togglebutton(wichbutton){
var button = document.getElementByID(wichbutton)
if (button.disabled=true) {
button.disabled = false
} else {
button.disabled = true
}
}
</script>With that you can disable or enable any button any time you wish...



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum