webForumDet fria alternativet

Jag behöver hjälp att bygga vidare på en dropdown-meny...

JavaScript

0 svar · 256 visningar · startad av kicki_an

Medlem sedan jan. 200556 inlägg
Frågan#1

Hejsan!

Jag skulle vilja få lite hjälp om hur man kan bygga vidare på en dropdown-meny.
Just nu fälls menyerna enbart ut nedåt, men jag skulle om möjligt vilja att vissa av undermenyerna som faller nedåt också kan falla ut vågrätt åt höger också.
Detta pga av att undermenyerna vi har, kan i sin tur leda till undermenyer.

Så det jag vill ha är en meny som faller i y-led men kan utvecklas i x-led om behövs.

Jag bifogar mina kodfiler om någon orkar kika på dem.

Det bör tilläggas att jag är helt inkompetent när det gäller Java, så var gärna övertydliga.

Tack på förhand!
//Kicki

Här är själva menyn:

hdrFontFace="Verdana";
hdrFontSize="2";
hdrTextColor="#FFFFFF";
subFontFace="Verdana";
subFontSize="1";
menuBGColor="#004286"; // Ändrar färgen på menyn
menuHRColor="#FFFFFF"; // Ändrar färgen på mellan menyerna
menuTarget="boss"; // Målframe
menuIsStatic="yes";
YOffset=0
staticYOffset=0
subBGColor="#004286"; // Ändrar färgen på submenyerna
subHRColor="#FFFFFF"; // Ändrar färgen på mellan menyerna

// Huvudmeny
startQuick();
addQuick('Kontakt', 'javascript://', '', 'Cont');
addQuick('Kontor', 'javascript://', '', 'Kontor_links');
addQuick('FlexInfo', 'javascript://', '', 'flex');
endQuick();

// Kontakt undermeny
startSubQuick('Cont', '130');
addSubQuick('---------------------', 'javascript://');
addSubQuick('Kontorslista', '/* länk */');
addSubQuick('Avdelningschefer', '/* länk */');
endSubQuick();

// Kontor undermeny
startSubQuick('Kontor_links', '150');
addSubQuick('---------------------', 'javascript://');
addSubQuick('Kortförsäkringsvillkor', '/* länk */');
endSubQuick();

// Flex Info undermeny
startSubQuick('flex', '150');
addSubQuick('---------------------', 'javascript://');
addSubQuick('Veckans Info', '/intranet/vi/vi.php');
addSubQuick('Veckans Info Arkiv', '/intranet/vi/vi_arkiv.php');
endSubQuick();

Menyhanteraren:

var IE=document.all
var NS=document.layers

function showQuick(layer, e){
if (window.hiding){setTimeout('clearTimeout(hiding)', 1);}
if (IE) {
document.all(layer).style.pixelLeft=document.body.scrollLeft+event.clientX-event.offsetX
document.all(layer).style.pixelTop=document.body.scrollTop+event.clientY-event.offsetY+quickMenu.offsetHeight-4
showing = setTimeout('document.all("'+layer+'").style.visibility="visible"', 1)
if (document.all(layer).style.pixelLeft+document.all(layer).offsetWidth>quickMenu.offsetWidth){
document.all(layer).style.pixelLeft=quickMenu.offsetWidth-document.all(layer).offsetWidth}}
if (NS) {
document.layers[layer].left=e.pageX-e.layerX
document.layers[layer].top=e.pageY-e.layerY+document.quickMenu.document.height-4
showing = setTimeout('document.layers["'+layer+'"].visibility="show"', 1)
if (document.layers[layer].left+document.layers[layer].document.width>document.quickMenu.document.width){
document.layers[layer].left=document.quickMenu.document.width-document.layers[layer].document.width}}}
function showQuick2(layer){
if (window.hiding){clearTimeout(hiding);hiding="";}
if (IE) {document.all(layer).style.visibility="visible";}
if (NS) {document.layers[layer].visibility="show";}}
function hideQuick(layer, header) {
if (window.showing){clearTimeout(showing);}
if (header!="head"){
hiding = setTimeout('hideQuick2(\''+layer+'\')', 0)}
else {hideQuick2(layer)}}
function hideQuick2(layer){
if (IE) {document.all(layer).style.visibility="hidden"}
if (NS) {document.layers[layer].visibility="hide";}}

function makeQuickStatic() {
if (window.staticing){clearInterval(staticing); staticing = ""} 
if (IE) {quickMenu.style.pixelTop=document.body.scrollTop}
if (NS) {document.quickMenu.top=window.pageYOffset}
staticing = setInterval('makeQuickStatic()', 1)}

function startQuick() {
if (IE){style='<DIV ALIGN="LEFT" ID="quickMenu" STYLE="position:absolute;top:0px;left:0px;Z-Index:200;width:1px">'; width=document.body.clientWidth-16}
else {style=""; width=window.innerWidth}
document.write('<LAYER NAME="quickMenu" Z-Index="200" TOP="0" LEFT="0">'+style)
document.write('<TABLE CELLPADDING="0" CELLSPACING=0 BORDER=0 BGCOLOR="'+menuBGColor+'" width="'+width+'"><TR><TD BGCOLOR="'+menuHRColor+'" HEIGHT=2><SPAN CLASS="quickhr">&nbsp;</SPAN></TD></TR><TR><TD><TABLE CELLPADDING="0" CELLSPACING=0 BORDER=0 BGCOLOR="'+menuBGColor+'"><TR><TD NOWRAP><FONT SIZE="'+hdrFontSize+'" FACE="'+hdrFontFace+'" COLOR="'+hdrTextColor+'"><B>|</B></TD>')
}
function addQuick(text, link, target, subName) {
if (target) {target=menuTarget}
if (subName){yesSub=' onmouseover="showQuick(\''+subName+'\', event)" onmouseout="hideQuick(\''+subName+'\', \'head\')"'} else {yesSub=""}
document.write('<TD NOWRAP><ILAYER><LAYER class="quickItems"'+yesSub+'><FONT SIZE="'+hdrFontSize+'" FACE="'+hdrFontFace+'" COLOR="'+hdrTextColor+'"><B>&nbsp;<SPAN'+yesSub+'><A HREF="'+link+'" class="quickItems" target="'+target+'">'+text+'</A></SPAN>&nbsp;|</LAYER></ILAYER></TD>')
}
function endQuick() {
document.write('</TR></TABLE></TD></TR></TABLE></LAYER>')
if (IE){document.write('</DIV>')}
if (menuIsStatic=="yes"){makeQuickStatic()}}

function startSubQuick(subName, width) {
if (!width){width=""}
if (IE)
document.write('<DIV ID="'+subName+'" ALIGN="LEFT" STYLE="position:absolute;top:14px;left:0px;visibility:hidden;z-index:5;width:1px" onmouseover="showQuick2(\''+subName+'\')" onmouseout="hideQuick(\''+subName+'\')">')
if (NS)
document.write('<LAYER name="'+subName+'" visibility="hide" top="14" left="0" onmouseover="showQuick2(\''+subName+'\')" onmouseout="hideQuick(\''+subName+'\')" Z-INDEX="5">')
document.write('<TABLE CELLPADDING="0" CELLSPACING=0 BORDER=0 BGCOLOR="'+subBGColor+'" WIDTH="'+width+'"><TR><TD BGCOLOR="'+subHRColor+'" HEIGHT=2 width="100%"><SPAN CLASS="quickhr">&nbsp;</SPAN></TD></TR><TR><TD NOWRAP><FONT SIZE="'+subFontSize+'" FACE="'+subFontFace+'"><B>')
}
function addSubQuick(text, link, target) {
if (!target) {target=menuTarget}
document.write('&nbsp;<A HREF="'+link+'" class="quickItems" target="'+target+'">'+text+'</A>&nbsp;&nbsp;<BR>')
}
function endSubQuick() {
if (IE) document.write('<BR></TD></TR></TABLE></DIV>')
if (NS) document.write('<BR></TD></TR></TABLE></LAYER>')
}

:) :)

257 ms totalt · 4 externa anrop · v20260731065814-full.1dc6f849
121 ms — deklarationer (db)
0 ms — hämta statistik (cache)
129 ms — hämta tråd, inlägg och bilagor (db)
126 ms — ändringar (db)