Friday, July 16, 2010

Disable ASP.NET menu control items using JavaScript

function ToggleMenuItems(on)
{
    var state = "disabled";
    if (on)
    {
        state = "";
    }
    var element = null;
    //Note that "all" will only work for IE - replace with "childNodes" for other browsers
    var count = $get("").tBodies[0].rows[0].all.length;
    for (var i = 0; i < count; ++i)
    {
        element = $get("").tBodies[0].rows[0].all[i];
        if (element.nodeName == "A")
        {
            element.disabled = state;
        }
    }
}

Thank you to:  http://forums.asp.net/p/1545146/3775042.aspx

No comments:

Post a Comment