home *** CD-ROM | disk | FTP | other *** search
Wrap
HTML Component | 2002-12-11 | 6.1 KB | 191 lines
<PUBLIC:COMPONENT lightWeight=true> <PUBLIC:EVENT name="onitemselect" ID="doselect"> <PUBLIC:ATTACH EVENT="oncontentready" ONEVENT="load()" /> <PUBLIC:ATTACH EVENT="onmouseout" ONEVENT="mouseout()" /> <PUBLIC:ATTACH EVENT="onmouseover" ONEVENT="mousemove()" /> <PUBLIC:ATTACH EVENT="onclick" ONEVENT="mouseup()" /> <PUBLIC:PROPERTY NAME="width" /> <PUBLIC:PROPERTY NAME="text" /> <PUBLIC:PROPERTY NAME="dropdowntop" /> <PUBLIC:PROPERTY NAME="dropdownleft" /> <PUBLIC:PROPERTY NAME="menutext" /> <PUBLIC:PROPERTY NAME="code" /> <PUBLIC:METHOD NAME="clickItem" /> <PUBLIC:METHOD NAME="itemFocus" /> <PUBLIC:METHOD NAME="itemBlur" /> <SCRIPT LANGUAGE="JScript"> var fDown = false; function load() { var sLeft, sRight; if (IsRTLPage()) { sLeft = 'right'; sRight = 'left'; } else { sLeft = 'left'; sRight = 'right'; } var s = '<table style="position:relative; z-index: 5;" width=' + width + ' id="' + element.uniqueID + 'small" border=0 cellpadding=0 cellspacing=0><tr>'; s += '<td height=18 width=9 style="cursor:default"><img id="' + element.uniqueID + 'left" style="display:none" border=0 src="images\\hover-' + sLeft + '.gif"></td>'; s += '<td height=18 id="' + element.uniqueID + 'mid" style="cursor:default; background: transparent x repeat-x top left" class=textTitle><A class=textTitle href="X" onclick="return false;">' + text + '</a></td>'; s += '<td id="' + element.uniqueID + 'arrow" style="cursor:default; padding-left:10; background: transparent x repeat-x top left" align=right><img border=0 src="images\\arrow-down.gif"></td>'; s += '<td height=18 width=9 style="cursor:default"><img id="' + element.uniqueID + 'right" style="display:none" border=0 src="images\\hover-' + sRight + '.gif"></td></tr></table>'; s += '<table width=' + width + ' style="display:none; position:absolute; z-index: 5;" id="' + element.uniqueID + 'menu" border=0 cellpadding=0 cellspacing=0>'; s += '<td height=18 width=9 valign=top style="cursor:default"><img border=0 src="images\\toc-top-' + sLeft + '.gif"></td>'; s += '<td height=18 style="cursor:default; background: white url(images\\toc-top.gif) repeat-x top left" class=textTitle><A href="x" onclick="return false;" class=textTitle>' + text + '</a></td>'; s += '<td style="cursor:default; padding-left:10; background: white url(images\\toc-top.gif) repeat-x top left" align=right><img border=0 src="images\\arrow-up.gif"></td>'; s += '<td height=18 width=9 valign=top style="cursor:default"><img border=0 src="images\\toc-top-' + sRight + '.gif"></td></tr>'; s += '<tr><td width=9 style="cursor:default; background: white url(images\\toc-' + sLeft + '.gif) repeat-y top left"></td>'; s += '<td colspan=2 style="background: white url(images\\toc-center.gif) repeat top left">' + BuildMenu() + '</td>'; s += '<td width=9 style="cursor:default; background: white url(images\\toc-' + sRight + '.gif) repeat-y top left"></td></tr>'; s += '<tr><td width=9 valign=bottom style="cursor:default"><img border=0 src="images\\toc-bottom-' + sLeft + '.gif"></td>'; s += '<td colspan=2 style="background: white url(images\\toc-bottom.gif) repeat-x bottom left"></td>'; s += '<td width=9 valign=bottom><img border=0 src="images\\toc-bottom-' + sRight + '.gif"></td></tr>'; s += '</table>'; element.style.height = 18; element.innerHTML = s; } function BuildMenu() { var s = '<table border=0 cellpadding=2 cellspacing=0>', aList, i; aList = menutext.split(';'); for (i = 0; i < aList.length; i++) { s += '<tr><td width=100%><A href="X" id="' + uniqueID + i + '" onblur="' + uniqueID + '.itemBlur(' + i + ');" onfocus="' + uniqueID + '.itemFocus(' + i + ');" clicknum="' + i + '" class=tocText> ' + aList[i] + ' </a></td></tr>'; } return s + '</table>'; } function setImage(iMode) { var sKey, sDisplay, id, a, sLeft, sRight; if (IsRTLPage()) { sLeft = 'right'; sRight = 'left'; } else { sLeft = 'left'; sRight = 'right'; } sDisplay = 'inline'; if (iMode == 1) sKey = 'hover'; else { sKey = 'normal'; sDisplay = 'none'; } a = element.document.all; id = element.uniqueID; a(id + 'left').src = 'images\\' + sKey + '-' + sLeft + '.gif'; if (sKey == 'normal') { a(id + 'mid').style.backgroundImage = ''; a(id + 'arrow').style.backgroundImage = ''; } else { a(id + 'mid').style.backgroundImage = 'url(images\\' + sKey + '-center.gif)'; a(id + 'arrow').style.backgroundImage = 'url(images\\' + sKey + '-center.gif)'; } a(id + 'right').src = 'images\\' + sKey + '-' + sRight + '.gif'; a(id + 'left').style.display = sDisplay a(id + 'right').style.display = sDisplay } function mouseout() { if (!fDown) setImage(0); else { if (event.srcElement.className == 'tocText') event.srcElement.style.backgroundColor = ''; } } function mousemove() { if (!fDown) setImage(1); else { if (event.srcElement.className == 'tocText') event.srcElement.style.backgroundColor = 'lightblue'; } } var iCurrentFocusItem = -1; function itemFocus(i) { iCurrentFocusItem = i; } function itemBlur(i) { iCurrentFocusItem = -1; } function mouseup() { var oMenu = element.document.all(element.uniqueID + 'menu') fDown = !fDown; if (fDown) element.setCapture(); else { var fClicked = false, oElement; element.releaseCapture(); if (event.srcElement.className == 'tocText') { fClicked = true; oElement = event.srcElement; } else if (iCurrentFocusItem != -1) { fClicked = true; oElement = element.document.all(uniqueID + iCurrentFocusItem); } if (fClicked) { oElement.style.backgroundColor = ''; window.setTimeout(element.uniqueID + '.clickItem(' + oElement.clicknum + ')', 0); } } element.document.all(element.uniqueID + 'small').style.display = fDown ? 'none' : 'inline'; oMenu.style.display = fDown ? 'inline' : 'none'; } function clickItem(i) { var e = createEventObject(); trackIt(code + 'N' + getClickIndex(i)); e.item = i; doselect.fire(e); return false; } </SCRIPT> </PUBLIC:COMPONENT>