[Project_owners] Disable OK button in dialog

Neil Deakin enndeakin at sympatico.ca
Thu Mar 18 14:36:49 EST 2004


Gustavo Bittencourt wrote:

>>Gustavo Araujo Bittencourt <g.bitten at bol.com.br> wrote:
>>
>>    
>>
>>>I am sure there is a very obvious way to
>>>      
>>>
>enable/disable OK button in 
>  
>
>>>dialog via javascript.
>>>I tried this:
>>> 
>>>      
>>>
>>document.getElementsByAttribute("label","OK").item(0).setAttribute("disabled",
>>    
>>
>
>  
>
>>>"true");
>>> 
>>>      
>>>
>>document.getElementsByAttribute("label","OK").item(0).removeAttribute("disabled");
>>    
>>
>>    
>>

If it's a <dialog>, you should use its getButton("accept") function to 
get the OK button.

You can disable a button by just setting the disabled property:

document.documentElement.getButton("accept").disabled = true;

/ Neil



More information about the Project_owners mailing list