add some enabling/disabling functions

This commit is contained in:
brade%netscape.com 1999-06-23 19:30:43 +00:00
Родитель ed37052d62
Коммит 61ca33839f
1 изменённых файлов: 43 добавлений и 0 удалений

Просмотреть файл

@ -38,6 +38,49 @@ function ValidateNumberString(value, minValue, maxValue)
return "";
}
// this function takes an elementID and a flag
// if the element can be found by ID, then it is either enabled (by removing "disabled" attr)
// or disabled (setAttribute) as specified in the "doEnable" parameter
function SetElementEnabledByID( elementID, doEnable )
{
element = document.getElementById(elementID);
if ( element )
{
if ( doEnable )
{
element.removeAttribute( "disabled" );
}
else
{
element.setAttribute( "disabled", "true" );
}
}
}
// this function takes an ID for a label and a flag
// if an element can be found by its ID, then it is either enabled or disabled
// The class is set to either "enabled" or "disabled" depending on the flag passed in.
// This function relies on css having a special appearance for these two classes.
function SetLabelEnabledByID( labelID, doEnable )
{
label = document.getElementById(labelID);
if ( label )
{
if ( doEnable )
{
label.setAttribute( "class", "enabled" );
}
else
{
label.setAttribute( "class", "disabled" );
}
}
else
{
dump( "not changing label"+labelID+"\n" );
}
}
// All dialogs share this simple method
function onCancel()
{