Irish SEO,  Marketing & Webmaster Discussion

 
Make money - save the planet!

Javascript Menu Help (again...)?

This is a discussion on Javascript Menu Help (again...)? within the Coding Help forums, part of the Webmaster Help category; Hey, I've found a perfect menu for what I want... well, almost The tutorial is here . I've set-up the ...


Go Back   Irish SEO, Marketing & Webmaster Discussion > Webmaster Help > Coding Help

Register Forum Rules FAQDonate Members List Calendar Search Today's Posts Mark Forums Read


Notices

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 21-04-2006, 12:04 PM
ButtermilkJack's Avatar
Wannabe Geek
 
Join Date: Feb 2006
Location: Dublin, Ireland
Posts: 267
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
ButtermilkJack will become famous soon enough
Default Javascript Menu Help (again...)?

Hey, I've found a perfect menu for what I want... well, almost The tutorial is here.

I've set-up the menu as instructed and have it working fine. But if I try to implement the new javascript mentioned by 'isobar' in Comment #7 at the end of the page (which I need to do), I run into problems.

Can anyone tell me how much of the 'old' javascript do I replace? Is it all of it, or only part of it?

The problem I have is the submenus no longer open at all Bear with me, I am a javascript novice!

Thanks!
__________________
Print & Web Design
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #2 (permalink)  
Old 21-04-2006, 12:11 PM
louie's Avatar
Senior Member
 
Join Date: Jan 2006
Location: Dublin, Ireland
Posts: 2,010
Nominated 5 Times in 3 Posts
TOTW/F/M Award(s): 0
louie has much to be proud oflouie has much to be proud oflouie has much to be proud oflouie has much to be proud oflouie has much to be proud oflouie has much to be proud oflouie has much to be proud oflouie has much to be proud of
Send a message via Yahoo to louie Send a message via Skype™ to louie
Default

Showing the code you have might help us to help you.
__________________
:. Web Design & Development Web Design Ireland
:. Search Engines Optimization Search Engines Optimization
:. Directory Submission Directory Submission
:. News & Press Release Ireland GiveItSocks.com
:. Used Cars Ireland, Car Parts & Car Audio Cars For Sale, Car Parts & Accessories
:. I Have 2 Find It Directory SEF Directory
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3 (permalink)  
Old 21-04-2006, 12:46 PM
ButtermilkJack's Avatar
Wannabe Geek
 
Join Date: Feb 2006
Location: Dublin, Ireland
Posts: 267
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
ButtermilkJack will become famous soon enough
Default

Quote:
Originally Posted by louie
Showing the code you have might help us to help you.
Sorry should've posted a link but it's the same as the code in the guys comment. I just copied and pasted out, and changed the onclick call as suggested.

Link to my page here
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4 (permalink)  
Old 21-04-2006, 01:09 PM
louie's Avatar
Senior Member
 
Join Date: Jan 2006
Location: Dublin, Ireland
Posts: 2,010
Nominated 5 Times in 3 Posts
TOTW/F/M Award(s): 0
louie has much to be proud oflouie has much to be proud oflouie has much to be proud oflouie has much to be proud oflouie has much to be proud oflouie has much to be proud oflouie has much to be proud oflouie has much to be proud of
Send a message via Yahoo to louie Send a message via Skype™ to louie
Default

I can not even see you menu.
It looks like you have something wrong in the stylesheet.

this code works:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
.menu1{
background-image:url(images/menudiv1bg.gif);
margin-left:25px;
padding-left:20px;
padding-top:2px;
padding-bottom: 2px;
display:block;
text-decoration: none;
color: #000000;
height: 20px;
}
.submenu{
background-image: url(images/submenu.gif);
display: block;
height: 19px;
margin-left: 38px;
padding-top: 2px;
padding-left: 7px;
color: #333333;
}
.hide{
display: none;
}
 
.show{
display: block;
}
</style>
<script language="JavaScript" type="text/JavaScript">
<!--
menu_status = new Array(); 
function showHide(theid){
    if (document.getElementById) {
    var switch_id = document.getElementById(theid);
        if(menu_status[theid] != 'show') {
           switch_id.className = 'show';
           menu_status[theid] = 'show';
        }else{
           switch_id.className = 'hide';
           menu_status[theid] = 'hide';
        }
    }
}
//-->
</script>
 
</head>
<body>
<div style="width:145px;">
<a href="#" class="menu1" onclick="showHide('mymenu1')">Menu 1</a>
    <div id="mymenu1" class="hide">
        <a href="#" class="submenu">Link One here</a>
        <a href="#" class="submenu">Link Two here</a>
        <a href="#" class="submenu">Link Three here</a>
        <a href="#" class="submenu">Link Four here</a>
    </div>
<a href="#" class="menu1" onclick="showHide('mymenu2')">Menu 2 </a>
    <div id="mymenu2" class="hide">
        <a href="#" class="submenu">Link One here</a>
        <a href="#" class="submenu">Link Two here</a>
        <a href="#" class="submenu">Link Three here</a>
        <a href="#" class="submenu">Link Four here</a>
    </div>
<a href="#" class="menu1" onclick="showHide('mymenu3')">Menu 3 </a>
    <div id="mymenu3" class="hide">
        <a href="#" class="submenu">Link One here</a>
        <a href="#" class="submenu">Link Two here</a>
        <a href="#" class="submenu">Link Three here</a>
        <a href="#" class="submenu">Link Four here</a>
    </div>
<a href="#" class="menu1" onclick="showHide('mymenu4')">Menu 4 </a>
    <div id="mymenu4" class="hide">
        <a href="#" class="submenu">Link One here</a>
        <a href="#" class="submenu">Link Two here</a>
        <a href="#" class="submenu">Link Three here</a>
        <a href="#" class="submenu">Link Four here</a>
    </div>
<a href="#" class="menu1" onclick="showHide('mymenu5')">Menu 5 </a>
    <div id="mymenu5" class="hide">
        <a href="#" class="submenu">Link One here</a>
        <a href="#" class="submenu">Link Two here</a>
        <a href="#" class="submenu">Link Three here</a>
        <a href="#" class="submenu">Link Four here</a>
    </div>
</div>
</body>
</html>

Last edited by louie; 21-04-2006 at 01:31 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5 (permalink)  
Old 21-04-2006, 01:48 PM
ButtermilkJack's Avatar
Wannabe Geek
 
Join Date: Feb 2006
Location: Dublin, Ireland
Posts: 267
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
ButtermilkJack will become famous soon enough
Default

Thanks for having a look at that! I've got the menu working as per the tutorial (and your code) but the problem happens when I try to replace the javascript with the javascript mentioned in the guys comment at the bottom of the page (in order to close un-clicked submenus).

Can you have a look at my link again and tell me if you can see the menu now. I've replace the original javascript so it should be back to the original working menu.

I need some way of closing the open submenu when another (closed) link is clicked.

Last edited by ButtermilkJack; 21-04-2006 at 01:50 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6 (permalink)  
Old 21-04-2006, 01:57 PM
louie's Avatar
Senior Member
 
Join Date: Jan 2006
Location: Dublin, Ireland
Posts: 2,010
Nominated 5 Times in 3 Posts
TOTW/F/M Award(s): 0
louie has much to be proud oflouie has much to be proud oflouie has much to be proud oflouie has much to be proud oflouie has much to be proud oflouie has much to be proud oflouie has much to be proud oflouie has much to be proud of
Send a message via Yahoo to louie Send a message via Skype™ to louie
Default

i tried that myself and it wasn't working so I gave up on it.

I can see you page in Firefox but not in IE.
As I said there is something wrong with the css you have.

to achieve all that ( auto hide ) you need more javascript then what's there.

You will be better off using some onmouseover menu the onclick.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7 (permalink)  
Old 21-04-2006, 02:27 PM
ButtermilkJack's Avatar
Wannabe Geek
 
Join Date: Feb 2006
Location: Dublin, Ireland
Posts: 267
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
ButtermilkJack will become famous soon enough
Default

Cheers, I'll have a look into it again over the weekend and see if I can come up with something else.

Thanks!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #8 (permalink)  
Old 21-04-2006, 08:34 PM
louie's Avatar
Senior Member
 
Join Date: Jan 2006
Location: Dublin, Ireland
Posts: 2,010
Nominated 5 Times in 3 Posts
TOTW/F/M Award(s): 0
louie has much to be proud oflouie has much to be proud oflouie has much to be proud oflouie has much to be proud oflouie has much to be proud oflouie has much to be proud oflouie has much to be proud oflouie has much to be proud of
Send a message via Yahoo to louie Send a message via Skype™ to louie
Default

As said to you, something nice and more reliable is using a dhtml menu.
To achive all that the code itself needs to be a lot more complicated.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #9 (permalink)  
Old 22-04-2006, 12:03 AM
ButtermilkJack's Avatar
Wannabe Geek
 
Join Date: Feb 2006
Location: Dublin, Ireland
Posts: 267
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
ButtermilkJack will become famous soon enough
Default

Hey, just to update you, I posted over on boards too and had some success from a guy who modifed the code for me.

All seems to be working fine now in all browsers!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #10 (permalink)  
Old 22-04-2006, 07:48 AM
louie's Avatar
Senior Member
 
Join Date: Jan 2006
Location: Dublin, Ireland
Posts: 2,010
Nominated 5 Times in 3 Posts
TOTW/F/M Award(s): 0
louie has much to be proud oflouie has much to be proud oflouie has much to be proud oflouie has much to be proud oflouie has much to be proud oflouie has much to be proud oflouie has much to be proud oflouie has much to be proud of
Send a message via Yahoo to louie Send a message via Skype™ to louie
Default

yes it does work the way you want, in firefox but i still cann't see it in IE.

you need to fix you css style somewhere.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
javascript, menu

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads

Thread Thread Starter Forum Replies Last Post
Javascript/CSS menu help? ButtermilkJack Coding Help 4 16-04-2006 05:59 PM


All times are GMT +1. The time now is 06:29 AM.


Powered by: vBulletin Version 3.7.3, Copyright ©2000 - 2008, Jelsoft Enterprises Limited.
Hosted in Ireland by Blacknight - Test your ISP |Irish Hosting Directory| Armchair.ie|Logo by Eden Web Design|Avatars by Afterglow |Latest Blog Entries | VPS HostingAd Management by RedTyger

Search Engine Friendly URLs by vBSEO 3.2.0