473,804 Members | 4,269 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

script for menu

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";
Jul 20 '05 #1
4 1516
Forgive me for saying possibly stupid things, I'm a seasoned programmer
but have only recently taken on Javascript.

natty wrote:
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
That makes me feel they are positioned absolutely, but the coordinates
don't get set (correctly).

When I try to read the script, I see getCoord() calls in a STYLE
attribute. That is a place to look into.

Are you sure you are using the browser for which the script was defined?

Are you interested in using the code I wrote to display menus?
I have a feeling it
might be to do with the amount of space in my frames,


I feel that is a less likely cause, but then again, I haven't completely
understood the script.

--
Bas Cost Budde
http://www.heuveltop.org/BasCB
but the domain is nl

Jul 20 '05 #2
any help with any menu codes would be very useful thanks, i am still
baffled on the code

Bas Cost Budde <ba*@heuveltop. org> wrote in message news:<c0******* ***@news2.solco n.nl>...
Forgive me for saying possibly stupid things, I'm a seasoned programmer
but have only recently taken on Javascript.

natty wrote:
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


That makes me feel they are positioned absolutely, but the coordinates
don't get set (correctly).

When I try to read the script, I see getCoord() calls in a STYLE
attribute. That is a place to look into.

Are you sure you are using the browser for which the script was defined?

Are you interested in using the code I wrote to display menus?
I have a feeling it
might be to do with the amount of space in my frames,


I feel that is a less likely cause, but then again, I haven't completely
understood the script.

Jul 20 '05 #3
In article <18************ **************@ posting.google. com>,
ha************@ hotmail.com enlightened us with...
any help with any menu codes would be very useful thanks, i am still
baffled on the code


I use HVMenu from http://www.dynamicdrive.com
I like it and it works well with my framed site, too.

--
--
~kaeli~
God was my co-pilot... but then we crashed in the mountains
and I had to eat him.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 20 '05 #4
natty wrote:
any help with any menu codes would be very useful thanks, i am still
baffled on the code


Remind me by mail if you don't get normal responses (my approach is not
necessarily less complex).

--
Bas Cost Budde
http://www.heuveltop.org/BasCB
but the domain is nl

Jul 20 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
1693
by: Berry B | last post by:
Hi! I'm extremely new to JavaScript programming, so bear with me pleace. I'm having trouble including a script into a page from an external .js file. I've put the following in the head; <script language="JavaScript" src="menu.js"></script> And in the body i've put the following: <BODY bgcolor="#000000" marginwirgin: 0" onLoad="printMenu()"
1
3256
by: bayouprophet | last post by:
Cant get menu script to to put linked page in the same frame. I am new to Java and I am wondering what am I doing wrong? below are my java applet file, frame.html file, and my text file and one of my link file that should load next to the menu on the same page. And Thank You in advance. Here is my menu applet: <html>
1
2167
by: Anthony | last post by:
Below is a script I found at http://javascript.internet.com/ for a cascading menu. The script works great but there is one thing that I would like modified. BecauseI am just learning javascript, I did not want to try to modify the code without a little help. When you place the mouse over the menu bar, this script calls the function to show the menu. I would like it modified to hide the menu when the mouse is removed. Please help. The...
3
3688
by: Angus | last post by:
I have a web page with a toolbar containing a Save button. The Save button can change contextually to be a Search button in some cases. Hence the button name searchsavechanges. The snippet of html is: <a class="searchsavechanges btn btn3d tbbtn" href="javascript:" style="position:static"> <div id="TBsearchsavechanges">Search</div> </a>
2
2153
by: lynx129 | last post by:
Hi there , I have php script that works fine under my server but I dont know how to put the html code inside my site. feedback.html <html dir="rtl"> <head> <title> ????? ??? </title> </head> <body>
7
3618
by: imtmub | last post by:
I have a page, Head tag Contains many Scripts and style sheet for Menu and Page. This code working fine and displaying menus and page as i wanted. Check this page for reference. http://www.marco.com.cn/web-content/marco_re10.html -------------------------------------------------------------- <head> <!-- InstanceBeginEditable name="doctitle" --> <title>Marco</title> <!-- InstanceEndEditable -->
0
9706
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9579
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10575
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10330
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10319
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10076
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6851
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2990
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.