Friday, September 30, 2011

Hides buttons from Associated Views

// Hides buttons from Associated Views

function HideViewButtons(Iframe, buttonTitles) {

debugger;

Iframe.onreadystatechange = function HideTitledButtons() {

if (Iframe.readyState == 'complete') {

var iFrame = frames[window.event.srcElement.id];

var liElements = iFrame.document.getElementsByTagName('li');

for (var j = 0; j < buttonTitles.length; j++) {

for (var i = 0; i < liElements.length; i++) {

if (liElements[i].getAttribute('title') == buttonTitles[j]) {

liElements[i].style.display = 'none';

break;

}

}

}

}

}

}


// Change the source of our IFRAME

var hideButtons = ["Add existing Trip Destination to this record", "Add a new Quote Kit Part to this record"];

HideViewButtons(document.getElementById("IFRAME_Destination"), hideButtons);