PDA

View Full Version : menucontents.js -drop down doesn't link to particular web page



teb77
03-31-2010, 04:11 PM
1) Script Title: AnyLink JS Drop Down Menu v2.2
subhead: Customization of the Drop Down Menu Contents

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex1/dropmenuindex.htm

3) Describe problem: Using menucontents.js
Within the drop down content I can't get the link go to a page that is an offshoot of the home (index) pg. why is that? For example,
["CNN", "http://www.cnn.com/WORLD/"]
This will only go to the home page (cnn.com) and not the web page WORLD. Why is that?

I'm stumped and have searched and searched for an answer to this. it's probably obvious but I'm very NEW to javascript. Many thanks.
:confused:

ddadmin
04-01-2010, 02:59 AM
Hmm there's no reason why you can have sub directories in your URLs for the menu. In fact, some of the URLs used in the menu demos contain sub directories. Please post a link to the page on your site that contains the problematic script so we can check it out.

teb77
04-01-2010, 04:10 PM
Yes, I forgot to give more info.! Sorry about that.

here is the link to my website (it's a test page I revised from dynamicdrive lesson--the link to that lesson is at the bottom):
http://www.frankfordfriendsschool.org/dynamicindex2.html

here is the javascript coding (the other .js and .css files [from lesson] weren't changed).
PLEASE NOTE: It's only the 2nd link (var anylinkmenu2) that I revised to go to my site's pages:

About Us (click to reveal)

var anylinkmenu1={divclass:'anylinkmenu', inlinestyle:'', linktarget:''} //First menu variable. Make sure "anylinkmenu1" is a unique name!
anylinkmenu1.items=[
["Dynamic Drive", "http://www.dynamicdrive.com/"],
["CSS Drive", "http://www.cssdrive.com/"],
["JavaScript Kit", "http://www.javascriptkit.com/"],
["Coding Forums", "http://www.codingforums.com/"],
["JavaScript Reference", "http://www.javascriptkit.com/jsref/"] //no comma following last entry!
]



var anylinkmenu2={divclass:'anylinkmenu', inlinestyle:'width:150px; background:#FDD271', linktarget:'_new'} //Second menu variable. Same precaution.
anylinkmenu2.items=[
["History", "http://www.frankfordfriendsschool.org/history/"],
["Philosophy", "http://www.frankfordfriendsschool.org/philosophy/"],
["Faculty & Staff", "http://www.frankfordfriendsschool.org/staff/"],
["Calendar", "http://www.frankfordfriendsschool.org/calendar/"],
["Contact Us", "http://www.frankfordfriendsschool.org/contact/"] //no comma following last entry!
]


var anylinkmenu3={divclass:'anylinkmenucols', inlinestyle:'', linktarget:'secwin'} //Third menu variable. Same precaution.
anylinkmenu3.cols={divclass:'column', inlinestyle:''} //menu.cols if defined creates columns of menu links segmented by keyword "efc"
anylinkmenu3.items=[
["Dynamic Drive", "http://www.dynamicdrive.com/"],
["CSS Drive", "http://www.cssdrive.com/"],
["JavaScript Kit", "http://www.javascriptkit.com/"],
["Coding Forums", "http://www.codingforums.com/"],
["JavaScript Reference", "http://www.javascriptkit.com/jsref/", "efc"],
["CNN", "http://www.cnn.com/WORLD/"],
["MSNBC", "http://www.msnbc.com/"],
["Google", "http://www.google.com/"],
["BBC News", "http://news.bbc.co.uk", "efc"],
["News.com", "http://www.news.com/"],
["SlashDot", "http://www.slashdot.com/"],
["Digg", "http://www.digg.com/"],
["Tech Crunch", "http://techcrunch.com"] //no comma following last entry!
]

var anylinkmenu4={divclass:'anylinkmenu', inlinestyle:'width:150px; background:#DFFDF4', linktarget:'_new'} //Second menu variable. Same precaution.
anylinkmenu4.items=[
["CNN", "http://www.cnn.com/WORLD/"],
["MSNBC", "http://www.msnbc.com/"],
["Google", "http://www.google.com/"],
["BBC News", "http://news.bbc.co.uk"] //no comma following last entry!
]

lesson's main page:

there are 2 files from lesson that weren't changed in this lesson:
anylinkmenu.js
anylinkmenu.css

teb77
04-01-2010, 04:15 PM
oh oh!
I don't think I did the coding tags accurately! Will this still work?

I didn't send you the link to the lesson:
http://www.dynamicdrive.com/dynamicindex1/dropmenuindex.htm

sorry about this.

ddadmin
04-02-2010, 08:03 AM
So in your test page (http://www.frankfordfriendsschool.org/dynamicindex2.html), which link within the drop down menu doesn't work?

teb77
04-02-2010, 02:12 PM
It's the 2nd link (var anylinkmenu2) that didn't work. I also tried adding .html to history, philosophy, staff, etc. and that didn't work. For ex: /history.html/
Below I have them listed w/o .html:


var anylinkmenu2={divclass:'anylinkmenu', inlinestyle:'width:150px; background:#FDD271', linktarget:'_new'} //Second menu variable. Same precaution.
anylinkmenu2.items=[
["History", "http://www.frankfordfriendsschool.org/history/"],
["Philosophy", "http://www.frankfordfriendsschool.org/philosophy/"],
["Faculty & Staff", "http://www.frankfordfriendsschool.org/staff/"],
["Calendar", "http://www.frankfordfriendsschool.org/calendar/"],
["Contact Us", "http://www.frankfordfriendsschool.org/contact/"] //no comma following last entry!
]

ddadmin
04-02-2010, 05:40 PM
Looking at the links for that menu:


anylinkmenu2.items=[
["History", "http://www.frankfordfriendsschool.org/history/"],
["Philosophy", "http://www.frankfordfriendsschool.org/philosophy/"],
["Faculty & Staff", "http://www.frankfordfriendsschool.org/staff/"],
["Calendar", "http://www.frankfordfriendsschool.org/calendar/"],
["Contact Us", "http://www.frankfordfriendsschool.org/contact/"] //no comma following last entry!
]


The issue is that the links themselves simply don't work, irrespective of the script. For example, try directly going to the first link (http://www.frankfordfriendsschool.org/history/) within the menu- it leads to a 404 page.

teb77
04-02-2010, 05:54 PM
oh dear. I shouldn't have included the history web page. I forgot that's to be developed in the future. Please bear with me and try one of the pages again (I deleted history). I'm so sorry!!

Again (in coding below) I tried it as:
http://www.frankfordfriendsschool.org/philosophy/
and
http://www.frankfordfriendsschool.org/philosophy.html/
I would think the link to philosophy.html would work but it didn't. Unless I'm missing something!

here is same coding but with ".html" added:

anylinkmenu2.items=[
["Philosophy", "http://www.frankfordfriendsschool.org/philosophy.html/"],
["Faculty & Staff", "http://www.frankfordfriendsschool.org/staff.html/"],
["Calendar", "http://www.frankfordfriendsschool.org/calendar.html/"],
["Contact Us", "http://www.frankfordfriendsschool.org/contact.html/"] //no comma following last entry!
]

teb77
04-05-2010, 07:13 PM
Hi, is there any way I could get some help on this? I hope it's clear enough now. Please look at my previous email (thread).

thank you!

ddadmin
04-06-2010, 03:24 AM
Sorry but I must still be missing something. Whether it's:

http://www.frankfordfriendsschool.org/philosophy/

or

http://www.frankfordfriendsschool.org/philosophy.html/

The issue is the same- the URL simply doesn't work (leads to a 404 page). When you include this link inside the menu, it naturally will also go to a 404 page when clicked on. Are you saying one or both of the above links work for you when you directly enter it into the browser URL bar?

teb77
04-06-2010, 04:08 AM
yes, it works as:
http://www.frankfordfriendsschool.org/philosophy.html

The only reason i had the "/" after .html was because the coding example had it. Do you mean I don't need to use that "/"? If that's the case, I feel really bad that I took your time. :o

in other words, the coding would be:
anylinkmenu2.items=[
["Philosophy", "http://www.frankfordfriendsschool.org/philosophy.html"],
["Faculty & Staff", "http://www.frankfordfriendsschool.org/staff.html"],
["Calendar", "http://www.frankfordfriendsschool.org/calendar.html"],
["Contact Us", "http://www.frankfordfriendsschool.org/contact.html"] //no comma following last entry!
]

ddadmin
04-06-2010, 04:27 AM
Yep the trailing "/" is only used following directories and sub directories. It shouldn't be added to the end of file names. :)

teb77
04-06-2010, 04:40 AM
oh man.
I know this but for some reason I got it stuck in my head that the sample coding had to have the "/" at the end! Maybe it's because i know so little about JavaScript. It's REALLY obvious, isn't it?

Is there a good basic tutorial on JavaScript that you recommend? a url link to it?

Thank you so much for your patience!!!
I'm shaking my head at myself.
:o:o:o:o:o