I have been trying to edit a script for a drop down type menu. the
script is working as the sub menus flash up when i hover over the
title links, but they are appearing in the top left hand corner and
i'm not sure how to make them appear underneath. I have a feeling it
might be to do with the amount of space in my frames, as i have two
frames, one 20% where the script is loading and another 80% for my
main content, so the 20% is where my navigation wants to be. Is there
a way of getting round this? the script is below , thanks for any
help!
// Modify following four lines to customize your menu
var tdColor="#FFFFF F"; // menu item text color
var tdBgColor="#00A EED"; // menu item background color
var hlColor="#FFFFF F"; // highlight text color
var hlBgColor="#00A EED"; // highlight background color
// After change, modify same values in your DropDown.css file
////////////////////DO NOT MODIFY BELOW HERE//////////////////////
var md=250;
var ti=-1;
var oTd=new Object;
oTd=null;
function doMenu(td){
clearTimeout(ti );
td.style.backgr oundColor=hlBgC olor;
td.style.color= hlColor;
var i;
var sT="";
var tda=new Array();
tda=td.id.split ("_");
if(oTd!=null){
var tdo=new Array();
tdo=oTd.id.spli t("_");
for(i=1;i<tdo.l ength;i++){
sT+="_"+tdo[i];
if(tdo[i]!=tda[i]){
document.getEle mentById("td"+s T).style.backgr oundColor=tdBgC olor;
document.getEle mentById("td"+s T).style.color= tdColor;
if(document.get ElementById("tb l"+sT)!=null )
document.getEle mentById("tbl"+ sT).style.visib ility="hidden";
}
}
}
oTd=td;
sT="tbl";
for(i=1;i<tda.l ength;i++)
sT+="_"+tda[i];
if(document.get ElementById(sT) !=null)
document.getEle mentById(sT).st yle.visibility= "visible";
}
function clearMenu(){
if(oTd!=null){
var tdo=new Array();
tdo=oTd.id.spli t("_");
var sT="";
for(var i=1;i<tdo.lengt h;i++){
sT+="_"+tdo[i];
document.getEle mentById("td"+s T).style.backgr oundColor=tdBgC olor;
document.getEle mentById("td"+s T).style.color= tdColor;
if(document.get ElementById("tb l"+sT)!=null )
document.getEle mentById("tbl"+ sT).style.visib ility="hidden";
}
oTd=null;
}
}
function runMenu(strURL) {
location.href=s trURL;
}
var tt="";
var sT="";
var pT=new Array();
var tA=new Array();
function getCoord(st){
tA=st.split("_" );
if(tA.length>2) {
tA=tA.slice(0,-1);
tt=tA.join("_") ;
return (document.getEl ementById("tbl" +tt).offsetTop+ document.getEle mentById("td"+s t).offsetTop)+" px;left:"+
(document.getEl ementById("tbl" +tt).offsetLeft +document.getEl ementById("td"+ st).offsetWidth )+"px\">";
}
return (document.getEl ementById("main menu").offsetTo p+document.getE lementById("td" +st).offsetHeig ht)+"px;left:"+
(document.getEl ementById("main menu").offsetLe ft+document.get ElementById("td "+st).offsetLef t)+"px\">";
}
var sH="<table class=\"menu\" id=\"mainmenu\" cellspacing=\"0 \"><tr>";
var p=0;
var j=0;
while(eval("typ eof(td_"+ ++j +")!=\"undefine d\"")){
sH+="<td id=\"td_"+j+"\" onmouseover=\"d oMenu(this)\"
onmouseout=\"ti =setTimeout('cl earMenu()',md)\ "";
sH+=(eval("type of(url_"+j+")!= \"undefined\"") )?"
onclick=\"runMe nu('"+eval("url _"+j)+"')\">":" >";
sH+=eval("td_"+ j)+"</td>";
if (eval("typeof(t d_"+j+"_1)!=\"u ndefined\""))
pT[p++]="_"+j;
}
sH+="</tr></table>";
document.write( sH);
for(var q=0;typeof(pT[q])!="undefined"; q++){
sT=pT[q];
sH="";
j=0;
sH+="<table class=\"menu\" id=\"tbl"+sT+"\ " cellspacing=\"0 \"
style=\"top:"+g etCoord(sT);
while (eval("typeof(t d"+sT+"_"+ ++j +")!=\"undefine d\"")){
sH+="<tr><td id=\"td"+sT+"_" +j+"\" onmouseover=\"d oMenu(this)\"
onmouseout=\"ti =setTimeout('cl earMenu()',md)\ "";
sH+=(eval("type of(url"+sT+"_"+ j+")!=\"undefin ed\""))?"
onclick=\"runMe nu('"+eval("url "+sT+"_"+j)+"') \">":">";
sH+=eval("td"+s T+"_"+j)+"</td></tr>";
if (eval("typeof(t d"+sT+"_"+j+"_1 )!=\"undefined\ ""))
pT[p++]=sT+"_"+j;
}
sH+="</table>";
document.write( sH);
}
document.getEle mentById("mainm enu").style.vis ibility="visibl e";
script is working as the sub menus flash up when i hover over the
title links, but they are appearing in the top left hand corner and
i'm not sure how to make them appear underneath. I have a feeling it
might be to do with the amount of space in my frames, as i have two
frames, one 20% where the script is loading and another 80% for my
main content, so the 20% is where my navigation wants to be. Is there
a way of getting round this? the script is below , thanks for any
help!
// Modify following four lines to customize your menu
var tdColor="#FFFFF F"; // menu item text color
var tdBgColor="#00A EED"; // menu item background color
var hlColor="#FFFFF F"; // highlight text color
var hlBgColor="#00A EED"; // highlight background color
// After change, modify same values in your DropDown.css file
////////////////////DO NOT MODIFY BELOW HERE//////////////////////
var md=250;
var ti=-1;
var oTd=new Object;
oTd=null;
function doMenu(td){
clearTimeout(ti );
td.style.backgr oundColor=hlBgC olor;
td.style.color= hlColor;
var i;
var sT="";
var tda=new Array();
tda=td.id.split ("_");
if(oTd!=null){
var tdo=new Array();
tdo=oTd.id.spli t("_");
for(i=1;i<tdo.l ength;i++){
sT+="_"+tdo[i];
if(tdo[i]!=tda[i]){
document.getEle mentById("td"+s T).style.backgr oundColor=tdBgC olor;
document.getEle mentById("td"+s T).style.color= tdColor;
if(document.get ElementById("tb l"+sT)!=null )
document.getEle mentById("tbl"+ sT).style.visib ility="hidden";
}
}
}
oTd=td;
sT="tbl";
for(i=1;i<tda.l ength;i++)
sT+="_"+tda[i];
if(document.get ElementById(sT) !=null)
document.getEle mentById(sT).st yle.visibility= "visible";
}
function clearMenu(){
if(oTd!=null){
var tdo=new Array();
tdo=oTd.id.spli t("_");
var sT="";
for(var i=1;i<tdo.lengt h;i++){
sT+="_"+tdo[i];
document.getEle mentById("td"+s T).style.backgr oundColor=tdBgC olor;
document.getEle mentById("td"+s T).style.color= tdColor;
if(document.get ElementById("tb l"+sT)!=null )
document.getEle mentById("tbl"+ sT).style.visib ility="hidden";
}
oTd=null;
}
}
function runMenu(strURL) {
location.href=s trURL;
}
var tt="";
var sT="";
var pT=new Array();
var tA=new Array();
function getCoord(st){
tA=st.split("_" );
if(tA.length>2) {
tA=tA.slice(0,-1);
tt=tA.join("_") ;
return (document.getEl ementById("tbl" +tt).offsetTop+ document.getEle mentById("td"+s t).offsetTop)+" px;left:"+
(document.getEl ementById("tbl" +tt).offsetLeft +document.getEl ementById("td"+ st).offsetWidth )+"px\">";
}
return (document.getEl ementById("main menu").offsetTo p+document.getE lementById("td" +st).offsetHeig ht)+"px;left:"+
(document.getEl ementById("main menu").offsetLe ft+document.get ElementById("td "+st).offsetLef t)+"px\">";
}
var sH="<table class=\"menu\" id=\"mainmenu\" cellspacing=\"0 \"><tr>";
var p=0;
var j=0;
while(eval("typ eof(td_"+ ++j +")!=\"undefine d\"")){
sH+="<td id=\"td_"+j+"\" onmouseover=\"d oMenu(this)\"
onmouseout=\"ti =setTimeout('cl earMenu()',md)\ "";
sH+=(eval("type of(url_"+j+")!= \"undefined\"") )?"
onclick=\"runMe nu('"+eval("url _"+j)+"')\">":" >";
sH+=eval("td_"+ j)+"</td>";
if (eval("typeof(t d_"+j+"_1)!=\"u ndefined\""))
pT[p++]="_"+j;
}
sH+="</tr></table>";
document.write( sH);
for(var q=0;typeof(pT[q])!="undefined"; q++){
sT=pT[q];
sH="";
j=0;
sH+="<table class=\"menu\" id=\"tbl"+sT+"\ " cellspacing=\"0 \"
style=\"top:"+g etCoord(sT);
while (eval("typeof(t d"+sT+"_"+ ++j +")!=\"undefine d\"")){
sH+="<tr><td id=\"td"+sT+"_" +j+"\" onmouseover=\"d oMenu(this)\"
onmouseout=\"ti =setTimeout('cl earMenu()',md)\ "";
sH+=(eval("type of(url"+sT+"_"+ j+")!=\"undefin ed\""))?"
onclick=\"runMe nu('"+eval("url "+sT+"_"+j)+"') \">":">";
sH+=eval("td"+s T+"_"+j)+"</td></tr>";
if (eval("typeof(t d"+sT+"_"+j+"_1 )!=\"undefined\ ""))
pT[p++]=sT+"_"+j;
}
sH+="</table>";
document.write( sH);
}
document.getEle mentById("mainm enu").style.vis ibility="visibl e";
Comment