Code: Select all
function toggleDropDownByClass(className) {
// Find the correct div element
var dropdownDiv = "undefined";
var divs = document.getElementsByTagName("div");
// for each 'div'...
for (i=0; i < divs.length && dropdownDiv == "undefined"; i++)
{
// see if the div is of class 'className'
var classNode = divs[i].className;
if (classNode != "undefined" && classNode == className) {
dropdownDiv = divs[i];
}
}
if (dropdownDiv == "undefined") {
return;
}
// get the 'A' element inside the dropdown head
var headAElement = "undefined";
// ASSUMPTION that the first 'div' under the dropdown 'div' is the dropdown head,
// and that there is only one 'a' under the dropdown head div.
var headDiv = dropdownDiv.getElementsByTagName('div')[0];
headAElement = headDiv.getElementsByTagName("a")[0];
// ASSUMPTION that this method name won't change and will be in scope
FMCDropDown(headAElement);
}