Online Shopping : Computers : Programming : Languages : JavaScript

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

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

Entry

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,


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Vithaa,
     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
www.DaveClarkConsulting.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
http://www.businessian.com
http://www.computerstan.com
http://www.financestan.com
http://www.healthstan.com
http://www.internetstan.com
http://www.moneyenews.com
http://www.technologystan.com
http://www.zobab.com
http://www.healthinhealth.com