OnClick problemo's

Discussion in 'JavaScript' started by Wezz0, Oct 3, 2007.

  1. #1
    Hi guys

    I have 4 buttons on my html with onclick events. I access these onclick events by their div tag... everything works fine till i have to disable one of these buttons. Now the only way for me to disable it is by setting the onclick event to null.... As soon as this is done the next time that screen is shown then that button is still disabled... my problematic area is shown in BOLD....

    The validation of the button is all fine.... as the buttons should only display if the enabled attribute in the XML is set to true...

    Any help is greatly appreciated

    Thanks in advance
    oRootStyleXMLData.selectSingleNode("Options/Option[@ID='" + i + "']"))
    {
    var oAttribOptions = oRootStyleXMLData.selectSingleNode("Options/Option[@ID='" + i + "']").attributes;
    var oAttribEnabled = oAttribOptions.getNamedItem("Enabled");

    [B]							if (oAttribEnabled.value == "false" && i <= 4)
    							{
    								document.getElementById(sBtnImgID).innerHTML = "<img src='IMAGES/LH_Button_New.gif'/>";
    								//alert(document.getElementById(sBtnImgID).onclick);
    								//document.getElementById(sBtnClick).style.visibility = "hidden";
    								//TO DO DISABLE CLICK ON BUTTON
    								
    								alert(document.getElementById(sBtnClick).onclick);
    								document.getElementById(sBtnClick).onclick = null;
    								alert(document.getElementById(sBtnClick).onclick);
    																	
    							}
    							else if (oAttribEnabled.value == "false" && i >= 5)
    							{
    								document.getElementById(sBtnImgID).innerHTML = "<img src='IMAGES/RH_Button_New.gif'/>";
    								//TO DO DISABLE CLICK ON BUTTON 
    								//alert(document.getElementById(sBtnImgID).onclick);
    								alert(document.getElementById(sBtnClick).onclick);
    								document.getElementById(sBtnClick).onclick = null;
    								alert(document.getElementById(sBtnImgID).onclick);[/B]
    							}
    Code (markup):

     
    Wezz0, Oct 3, 2007 IP