Online Shopping : Computers : Programming : Languages : JavaScript

+ Search
Add Entry AlertManage Folder Edit Entry Add page to
Did You Find This Entry Useful?

8 of 14 people (57%) answered Yes
Recently 4 of 10 people (40%) answered Yes


How to pass the control name (button) to a js function where the control is disabled?

Apr 8th, 2008 19:23
ha mo, Dave Clark, Vithaa Ferna,

     I'm not 100% certain what you mean by that.  You can certainly 
pass the name of any form field by using the string literal name of 
the field.  For example:
onclick="return EnableButton(this, 'buttonName')"
     Then, that function can use the name something like this:
function EnableButton(ctl, btnName)
    var btn = ctl.form.elements[btnName];
    btn.disabled = false;
    return true;
Take care,
Dave Clark