dropdown menu
Jeg har fundet et script hos www.brainjar.com (som pt. undergår en fornyelse, hvilket gør at scriptet ikke er der) og fik det til at virke (næsten), og nu er jeg ved at få scriptet til at virke på en anden side, men der kommer slet ikke noget frem?!? Jeg er ikke javascript programmør, så jeg aner ikke hvor fejlen er.Her er scriptet:
<script language=\"JavaScript\" src=\"dhtmllib.js\"></script>
<script language=\"JavaScript\" src=\"popupmenu.js\"></script>
<script language=\"JavaScript\" src=\"popcond.js\"></script>
<script language=\"JavaScript\" src=\"frameMenus.js\"></script>
<script language=\"JavaScript\">
<!--
//-----------------------------------------------------------------------------
// Code for tracking the mouse position.
//-----------------------------------------------------------------------------
// These variables will hold the current mouse pointer position.
var mouseX = 0;
var mouseY = 0;
//-----------------------------------------------------------------------------
// Code for opening a menu in another frame.
//-----------------------------------------------------------------------------
var lastMenu = null; // Points to the last menu opened.
function displayMenu(frameName, menuName) {
var menu;
var x, y;
// Close the last menu opened, if it\'s still accessable.
if (lastMenu != null) {
if (isMinNS4 && lastMenu.isOpen)
lastMenu.close();
if (isMinIE4 && !isMinIE5)
lastMenu.close();
if (isMinIE5)
eval(\'try { lastMenu.close(); } catch(ex) {};\');
}
// Exit if given frame doesn\'t exist.
if (!parent.frames[frameName])
return;
// Get a handle to the menu. If it\'s not found, exit.
menu = eval(\"parent.frames[\'\" + frameName + \"\'].\" + menuName);
if (!menu)
return;
// Set the menu position based on the mouse position in this frame and any
// scrolling offsets.
x = parent.frames[frameName].getPageScrollX();
y = mouseY + parent.frames[frameName].getPageScrollY();
if (!menu.isOpen)
menu.open(x, y);
// Save the menu so it can be closed before another is opened.
lastMenu = menu;
}
var menu1 = new PopUpMenu(100);
menu1.addItem(new PopUpMenuItem(\"Om Kvickly Odder\", \"java script:top.frames[\'main\'].location = (\'kvicklyodder.html\')\"));
menu1.addItem(new PopUpMenuItem(\"Ledergruppen\", \"java script:top.frames[\'main\'].location = (\'ledergruppen.html\')\"));
menu1.addItem(new PopUpMenuItem(\"Bestyrelsen\", \"java script:top.frames[\'main\'].location = (\'bestyrelsen.html\')\"));
menu1.addItem(new PopUpMenuItem(\"Medlemsskab, dividende, Samvirke\", \"java script:top.frames[\'main\'].location = (\'medlemsskab.html\')\"));
menu1.addItem(new PopUpMenuItem(\"Arrangementer\", \"java script:top.frames[\'main\'].location = (\'arrangementer.html\')\"));
menu1.addItem(new PopUpMenuItem(\"Her bor vi\", \"java script:top.frames[\'main\'].location = (\'adresse.html\')\"));
var menu2 = new PopUpMenu(100);
menu2.addItem(new PopUpMenuItem(\"Bistro\", \"java script:top.frames[\'main\'].location = (\'bistro.htm\')\"));
menu2.addItem(new PopUpMenuItem(\"Café\", \"java script:top.frames[\'main\'].location = (\'cafe.html\')\"));
menu2.addItem(new PopUpMenuItem(\"Delikatessen\", \"java script:top.frames[\'main\'].location = (\'delikatessen.html\')\"));
menu2.addItem(new PopUpMenuItem(\"Slagter\", \"java script:top.frames[\'main\'].location = (\'slagter.html\')\"));
menu2.addItem(new PopUpMenuItem(\"Bager\", \"java script:top.frames[\'main\'].location = (\'bager.html\')\"));
menu2.addItem(new PopUpMenuItem(\"Kolonial\", \"java script:top.frames[\'main\'].location = (\'kolonial.html\')\"));
menu2.addItem(new PopUpMenuItem(\"Vin\", \"java script:top.frames[\'main\'].location = (\'vin.html\')\"));
menu2.addItem(new PopUpMenuItem(\"Frugt & Grønt\", \"java script:top.frames[\'main\'].location = (\'frugtoggroent.html\')\"));
menu2.addItem(new PopUpMenuItem(\"Isenkram\", \"java script:top.frames[\'main\'].location = (\'isenkram.html\')\"));
menu2.addItem(new PopUpMenuItem(\"Tekstil\", \"java script:top.frames[\'main\'].location = (\'tekstil.html\')\"));
menu2.addItem(new PopUpMenuItem(\"Parfumeri\", \"java script:top.frames[\'main\'].location = (\'parfumeri.html\')\"));
menu2.addItem(new PopUpMenuItem(\"Kiosk\", \"java script:top.frames[\'main\'].location = (\'kiosk.html\')\"));
function init() {
menu1.create();
menu2.create();
// Capture mouse clicks on the page.
if (isMinNS4)
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown = showIt;
}
function showIt(e) {
// Show the menu when the mouse is clicked on the page.
if (isMinNS4 && e.which == 1) {
routeEvent(e);
if (e.target == \"\" && !menu.isOpen)
menu.open();
}
if (isMinIE4 && window.event.button == 1 &&
window.event.srcElement.tagName != \"A\" &&
window.event.clientX < document.body.clientWidth &&
window.event.clientY < document.body.clientHeight &&
!menu.isOpen)
menu.open();
return true;
}
menu1.setSizes(0, 0, 0, 0);
menu1.setFont(\"Arial\", \"normal\", \"bold\", \"10pt\");
menu1.setColors(\"#FFFFCC\", \"#003366\", \"#FFFFCC\", \"#003366\",
\"#003366\", \"#FFFFCC\", \"#003366\", \"#FFFFCC\");
menu2.setSizes(0, 0, 0, 0);
menu2.setFont(\"Arial\", \"normal\", \"bold\", \"10pt\");
menu2.setColors(\"#FFFFCC\", \"#003366\", \"#FFFFCC\", \"#003366\",
\"#003366\", \"#FFFFCC\", \"#003366\", \"#FFFFCC\");
//-->
</script>
