473,473 Members | 2,144 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Menu

1 New Member
Have you help me? I have a code in 2 files: 2leveltab.css y 2leveltab.js and a HTML, this code download of site www.javascriptkit.com.
Then i need it of item the menu will paint one time choice of item submenu
code 2levelta.css:

Expand|Select|Wrap|Line Numbers
  1. .basictab{
  2. padding: 3px 0;
  3. margin-left: 0;
  4. font: bold 12px Verdana;
  5. border-bottom: 1px solid gray;
  6. list-style-type: none;
  7. margin-bottom: 0;
  8. text-align: left; /*set to left, center, or right to align the menu as desired*/
  9. }
  10.  
  11. .basictab li{
  12. display: inline;
  13. margin: 0;
  14. color: #8c0000;
  15. }
  16.  
  17. .basictab li a{
  18. text-decoration: none;
  19. padding: 3px 7px;
  20. margin-right: 2px;
  21. border: 1px solid gray;
  22. border-bottom: none;
  23. background-color: white;
  24. color: #8c0000;
  25. }
  26.  
  27.  
  28. .basictab li a:visited{
  29. color: #8c0000;
  30. }
  31.  
  32. .basictab li a:hover{
  33. background-color:#f7e96b;
  34. color: #8c0000;
  35. }
  36.  
  37. .basictab li a:active{
  38. background-color:#f7e96b;
  39. color: #8c0000;
  40. }
  41.  
  42. .basictab li.selected a{ /*selected tab effect*/
  43. position: relative;
  44. top: 1px;
  45. padding-top: 4px;
  46. background-color: none;
  47. color: #8c0000
  48. }
  49.  
  50.  
  51. .submenustyle{
  52. padding: 2px 1px;
  53. border: 1px solid black;
  54. border-top-width: 0;
  55. width: auto;
  56. display: none;
  57. filter:alpha(opacity=0);
  58. -moz-opacity:0;
  59. }
  60.  
  61. * html .submenustyle{ /*IE only width definition*/
  62. width: 100%;
  63. }
  64.  
  65. .submenustyle a{
  66. border-right: 1px dashed black;
  67. padding: 1px 5px;
  68. text-decoration: none;
  69. color: #8c0000
  70. }
  71.  
  72. .submenustyle a:hover{
  73. background-color: #CFBC0C;
  74. }
  75.  
---------
code of file 2leveltab.js

Expand|Select|Wrap|Line Numbers
  1. var mastertabvar=new Object()
  2. mastertabvar.baseopacity=0
  3. mastertabvar.browserdetect=""
  4.  
  5. function showsubmenu(masterid, id){
  6. if (typeof highlighting!="undefined")
  7. clearInterval(highlighting)
  8. submenuobject=document.getElementById(id)
  9. mastertabvar.browserdetect=submenuobject.filters? "ie" : typeof submenuobject.style.MozOpacity=="string"? "mozilla" : ""
  10. hidesubmenus(mastertabvar[masterid])
  11. submenuobject.style.display="block"
  12. instantset(mastertabvar.baseopacity)
  13. highlighting=setInterval("gradualfade(submenuobject)",50)
  14. }
  15.  
  16. function hidesubmenus(submenuarray){
  17. for (var i=0; i<submenuarray.length; i++)
  18. document.getElementById(submenuarray[i]).style.display="none"
  19. }
  20.  
  21. function instantset(degree){
  22. if (mastertabvar.browserdetect=="mozilla")
  23. submenuobject.style.MozOpacity=degree/100
  24. else if (mastertabvar.browserdetect=="ie")
  25. submenuobject.filters.alpha.opacity=degree
  26. }
  27.  
  28.  
  29. function gradualfade(cur2){
  30. if (mastertabvar.browserdetect=="mozilla" && cur2.style.MozOpacity<1)
  31. cur2.style.MozOpacity=Math.min(parseFloat(cur2.style.MozOpacity)+0.1, 0.99)
  32. else if (mastertabvar.browserdetect=="ie" && cur2.filters.alpha.opacity<100)
  33. cur2.filters.alpha.opacity+=10
  34. else if (typeof highlighting!="undefined") //fading animation over
  35. clearInterval(highlighting)
  36. }
  37.  
  38. function initalizetab(tabid){
  39. mastertabvar[tabid]=new Array()
  40. var menuitems=document.getElementById(tabid).getElementsByTagName("li")
  41. for (var i=0; i<menuitems.length; i++){
  42. if (menuitems[i].getAttribute("rel")){
  43. menuitems[i].setAttribute("rev", tabid) //associate this submenu with main tab
  44. mastertabvar[tabid][mastertabvar[tabid].length]=menuitems[i].getAttribute("rel") //store ids of submenus of tab menu
  45. if (menuitems[i].className=="selected")
  46. showsubmenu(tabid, menuitems[i].getAttribute("rel"))
  47. menuitems[i].getElementsByTagName("a")[0].onmouseover=function(){
  48. showsubmenu(this.parentNode.getAttribute("rev"), this.parentNode.getAttribute("rel"))
  49. }
  50. }
  51. }
  52. }
  53.  
--------------------
code of HTML
--------------------------
[HTML]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Documento sin t&iacute;tulo</title>
<link rel="stylesheet" type="text/css" href="2leveltab.css" />

<script type="text/javascript" src="2leveltab.js">

/***********************************************
* 2 level Horizontal Tab Menu- by JavaScript Kit (www.javascriptkit.com)
* This notice must stay intact for usage
* Visit JavaScript Kit at http://www.javascriptkit.com/ for full source code
***********************************************/

</script>
</head>

<body>
</body>
</html>
<ul id="maintab" class="basictab">
<li class="selected" rel="institucion"><a href="#">institucional ▼</a></li>
<li class="selected" rel="secretarias"><a href="#">secretarías ▼</a></li>
<li class="selected" rel="publica"><a href="#">publicaciones ▼</a></li>
<li class="selected" rel="nove"><a href="#">novedades</a></li>
</ul>

<div id="secretarias" class="submenustyle">
<a href="./prueba1.htm" target="mainFrame">general</a>
<a href="http://www.eleco.com.ar">administrativa</a>
<a href="http://www.institutoolivero.com.ar">académica</a>
<a href="http://www.institutoolivero.com.ar">extensión</a>
<a href="http://www.institutoolivero.com.ar">postgrado</a>
</div>

<div id="institucion" class="submenustyle">
<a href="./institucional/institu_historia.htm" target="mainFrame">historia</a>
<a href="./institucional/institu_autoridades.htm" target="mainFrame">autoridades</a>
<a href="./institucional/institu_contactos.htm" target="mainFrame">contactos</a>
</div>


<div id="publica" class="submenustyle">
<a href="http://www.unicen.edu.ar">la escalera</a>
<a href="http://www.javascriptkit.com/dhtmltutors/">el peldaño</a>
</div>

<div id="nove" class="submenustyle">
</div>

<script type="text/javascript">
//initialize tab menu, by passing in ID of UL
initalizetab("maintab")
</script>[/HTML]
Oct 12 '07 #1
3 1857
acoder
16,027 Recognized Expert Moderator MVP
Welcome to TSDN!

Can you explain clearly what you are trying to do? What does it do at present? What have you tried? Do you get any errors?

One thing I noticed in your HTML: your code is outside the body. You've closed the body and html tags and then you have the code that is supposed to appear in the body.
Oct 15 '07 #2
christianbing
1 New Member
I have the same problem, i.e. when the submenu elements are displayed, they are staying still, they don't disappear after mouse goes away from them. Can someone offer a solution for this?
Nov 22 '07 #3
acoder
16,027 Recognized Expert Moderator MVP
Welcome to TSDN!
I have the same problem, i.e. when the submenu elements are displayed, they are staying still, they don't disappear after mouse goes away from them. Can someone offer a solution for this?
Post your code or a link to a test page.
Nov 23 '07 #4

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

Similar topics

2
by: Jackson Yap | last post by:
can someone kind enough to help me look at the attached html and js file? Why is it that the javascript menu could not work at www.apchosting.net but could work at...
1
by: Jackson Yap | last post by:
can someone kind enough to help me look at the attached html and js file? Why is it that the javascript menu could not work at www.apchosting.net but could work at...
4
by: TycoonUK | last post by:
Hi, As I do not have IE7 on my computer, I was wondering if there is a fault in my CSS Menu when using IE7. Please can someone look at my site - http://www.worldofmonopoly.co.uk and tell me...
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
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,...
0
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...
1
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
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...
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,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.