473,395 Members | 1,905 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Question Concerning a Java Script Menu

Stang02GT
1,208 Expert 1GB
I posted a question in the HTML/CSS Forum but i have not received an answer. I have a menu that I am using from http://www.javascriptkit.com .

The exact url to the menu i am using is :

http://www.javascriptkit.com/script/script2/csstopmenu.shtml

My problem is that the page i placed the menu on, everything on that page is centered and stays underneath the page heading. I have having trouble positioning my menu within the same area as the rest of the page. I'm not sure if I can do this with JavaScript or if this is strictly an HTML/CSS Issue.


Any help is greatly appreciated.


Here is the javascript that the menu uses.

Expand|Select|Wrap|Line Numbers
  1. var cssmenuids=["cssmenu1"] //Enter id(s) of CSS Horizontal UL menus, separated by commas
  2. var csssubmenuoffset=-1 //Offset of submenus from main menu. Default is 0 pixels.
  3.  
  4. function createcssmenu2(){
  5. for (var i=0; i<cssmenuids.length; i++){
  6.   var ultags=document.getElementById(cssmenuids[i]).getElementsByTagName("ul")
  7.     for (var t=0; t<ultags.length; t++){
  8.             ultags[t].style.top=ultags[t].parentNode.offsetHeight+csssubmenuoffset+"px"
  9.         var spanref=document.createElement("span")
  10.             spanref.className="arrowdiv"
  11.             spanref.innerHTML="&nbsp;&nbsp;&nbsp;&nbsp;"
  12.             ultags[t].parentNode.getElementsByTagName("a")[0].appendChild(spanref)
  13.         ultags[t].parentNode.onmouseover=function(){
  14.                     this.style.zIndex=100
  15.         this.getElementsByTagName("ul")[0].style.visibility="visible"
  16.                     this.getElementsByTagName("ul")[0].style.zIndex=0
  17.         }
  18.         ultags[t].parentNode.onmouseout=function(){
  19.                     this.style.zIndex=0
  20.                     this.getElementsByTagName("ul")[0].style.visibility="hidden"
  21.                     this.getElementsByTagName("ul")[0].style.zIndex=100
  22.  
  23.         }
  24.     }
  25.   }
  26. }
  27.  
  28. if (window.addEventListener)
  29. window.addEventListener("load", createcssmenu2, false)
  30. else if (window.attachEvent)
  31. window.attachEvent("onload", createcssmenu2)
Jan 15 '08 #1
8 1500
Stang02GT
1,208 Expert 1GB
here is the link to the post in the HTML/CSS form also in case anyone would like to see it as well.


http://www.thescripts.com/forum/thread757392.html
Jan 15 '08 #2
acoder
16,027 Expert Mod 8TB
You can set it with JavaScript, but I think you'd be better off setting it with CSS so that it's correctly positioned whilst loading and not after loading.
Jan 16 '08 #3
Stang02GT
1,208 Expert 1GB
You can set it with JavaScript, but I think you'd be better off setting it with CSS so that it's correctly positioned whilst loading and not after loading.

Ok, what do you suggest is the best way to do that?
Jan 16 '08 #4
acoder
16,027 Expert Mod 8TB
Ok, what do you suggest is the best way to do that?
That's better left to the thread in the HTML forum where I see that you now have a response. You may need to post the page heading code too.
Jan 16 '08 #5
Stang02GT
1,208 Expert 1GB
Found the solution to my problem. I placed the menu in a table and it aloud me to position it wherever i needed it to be.
Jan 18 '08 #6
acoder
16,027 Expert Mod 8TB
Found the solution to my problem. I placed the menu in a table and it aloud me to position it wherever i needed it to be.
I don't think using tables for positioning is a good idea. If you use divs, or just set the left/top properties of the containing div, it'd be better. See this link for more information.
Jan 18 '08 #7
Stang02GT
1,208 Expert 1GB
lol unfortunately i couldn't get any suggestions or pointers form anyone and thats what i came up with doing. I mean it works fine i don't really see whats wrong with it?
Jan 18 '08 #8
acoder
16,027 Expert Mod 8TB
This link might help explain.
Jan 18 '08 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Alexander Fillips | last post by:
Hi, my short question: is there a python object which can interpret java-script? the whole story ;-) I wrote some streaming-scripts for the xbox mediaplayer which supports python. for a...
14
by: Dafydd | last post by:
I have the following Script in my web page reduce to two pages. <script> function details() { document.getElementById('details').style.visibility='visible';...
1
by: bergarath | last post by:
Can anyone see whats the problem here. Menus wont open..Works fine i IE, but none else.. I also need the menus to shut automatically when the next opens.. possibly with a java script function? ...
34
by: kpg | last post by:
Hello all, I have an asp.net web application with tons of Java script files. I would like to protect the Java Script somehow so it can't be seen by a remote user. I found several 3rd party...
5
by: Ankur | last post by:
Hi Folks, I am new for this group. I want to clarify one thing what's a basic difference between Client Side Java Script and Server Side Java Script. how we can differentiate it. Why we called...
2
by: sajithamol | last post by:
Is there any pre-defined java script function for invoking the file menu of a browser directly, just like window.print()? Is there an option to invoke the view source tab directly using a function?
0
by: rohitbce | last post by:
I have written code to generate dropdown menu in java script. it overlap all the controls of the pages like label,radio,images except the drop down list control. for the drop down i have tryied...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.