PDA

View Full Version : Menu Items Not Displaying Properly


nelsonjs
07-21-2008, 09:38 PM
Hi folks,

It appears as if something is eating my code. I'm trying to make some changes to the menu at http://chn.org by modifying this file (http://www.chn.org/scripts/menu.js).

When I replace the old menu.js with the new one, it seems to swallow the code and doesn't display the menu at all.

Here is the original code and screenshot:

Menu1=new Array("About CHN","http://www.chn.org/about/index.html","",6,15,150);
Menu1_1=new Array(" Board of Directors","http://www.chn.org/about/board.html","",0,18,150);
Menu1_2=new Array(" Membership","http://www.chn.org/about/membership.html","",0);
Menu1_3=new Array(" Internships at CHN","http://www.chn.org/jobs/internships.html","",0);
Menu1_4=new Array(" Support CHN","https://secure.democracyinaction.org/dia/organizations/chn/shop/custom.jsp?donate_page_KEY=11","",0);
Menu1_5=new Array(" CHN Staff","http://www.chn.org/about/staff.html","",0);
Menu1_6=new Array(" Contact Us","http://www.chn.org/about/contact.html","",0);

Menu2=new Array("Issues","http://www.chn.org/issues/","",14,15,140);
Menu2_1=new Array("Block Grants","http://www.chn.org/issues/blockgrants/","",0,18,275);
Menu2_2=new Array("Budget and Appropriations","http://www.chn.org/issues/budget/","",0,18,275);
Menu2_3=new Array("Disabilities","http://www.chn.org/issues/disabilities/","",1,18,275);
Menu2_3_1=new Array("Individuals with Disabilities Education Act (IDEA)","http://www.chn.org/issues/idea/","",0,18,300);
Menu2_4=new Array("Education and Youth Policy","http://www.chn.org/issues/education/","",3,18,275);
Menu2_4_1=new Array("Head Start","http://www.chn.org/issues/headstart/","",0,18,300);
Menu2_4_2=new Array("Individuals with Disabilities Education Act (IDEA)","http://www.chn.org/issues/idea/","",0);
Menu2_4_3=new Array("Juvenile Justice","http://www.chn.org/issues/juvenilejustice/","",0);
Menu2_5=new Array("Food and Nutrition","http://www.chn.org/issues/foodandnutrition/","",2,18,275);
Menu2_5_1=new Array("Child Nutrition","http://www.chn.org/issues/childnutrition/","",0,18,250);
Menu2_5_2=new Array("Food Stamps","http://www.chn.org/issues/foodstamps/","",0);
Menu2_6=new Array("Health","http://www.chn.org/issues/health/","",3,18,275);
Menu2_6_1=new Array("Medicaid","http://www.chn.org/issues/medicaid/","",0,18,300);
Menu2_6_2=new Array("Medicare","http://www.chn.org/issues/medicare/","",0);
Menu2_6_3=new Array("The Uninsured","http://www.chn.org/issues/uninsured/","",0);
Menu2_7=new Array("Housing and Homelessness","http://www.chn.org/issues/housing/","",1,18,275);
Menu2_7_1=new Array("Low Income Home Energy Assistance Program (LIHEAP)","http://www.chn.org/issues/liheap/","",0,18,335);
Menu2_8=new Array("Human Needs Statistics","http://www.chn.org/issues/statistics/","",1,18,275);
Menu2_8_1=new Array("State-by-State Data","http://www.chn.org/issues/statistics/state.html","",0,18,200);
Menu2_9=new Array("Immigrants","http://www.chn.org/issues/immigrants/","",0,18,275);
Menu2_10=new Array("Labor and Employment","http://www.chn.org/issues/labor/","",4,18,275);
Menu2_10_1=new Array("Earned Income Tax Credit (EITC)","http://www.chn.org/issues/eitc/","",0,18,200);
Menu2_10_2=new Array("Job Training and Education","http://www.chn.org/issues/jobtraining/","",0);
Menu2_10_3=new Array("Minimum Wage","http://www.chn.org/issues/minimumwage/","",0);
Menu2_10_4=new Array("Unemployment Insurance (UI)","http://www.chn.org/issues/ui/","",0);
Menu2_11=new Array("Social Security","http://www.chn.org/issues/socialsecurity/","",0,18,275);
Menu2_12=new Array("Social Services","http://www.chn.org/issues/socialservices/","",3,18,275);
Menu2_12_1=new Array("Child Care","http://www.chn.org/issues/childcare/","",0,18,275);
Menu2_12_2=new Array("Child Protection, Foster Care and Adoption","http://www.chn.org/issues/adoption/","",0);
Menu2_12_3=new Array("Social Services Block Grant (SSBG)","http://www.chn.org/issues/ssbg/","",0);
Menu2_13=new Array("Tax Policy","http://www.chn.org/issues/taxpolicy/","",0,18,275);
Menu2_14=new Array("Welfare/Income Support","http://www.chn.org/issues/welfare/","",2,18,275);
Menu2_14_1=new Array("Temporary Assistance for Needy Families (TANF)","http://www.chn.org/issues/tanf/","",0,18,335);
Menu2_14_2=new Array("Low Income Home Energy Assistance Program (LIHEAP)","http://www.chn.org/issues/liheap/","",0);

Menu3=new Array("Publications","#","",2,15,165);
Menu3_1=new Array(" Human Needs Report","http://www.chn.org/humanneeds/index.html","",0,18,165);
Menu3_2=new Array(" CHN Analyses","http://www.chn.org/analyses/","",0);

Menu4=new Array("Take Action","http://www.chn.org/takeaction/index.html","",4,15,160);
Menu4_1=new Array("Action Alerts","http://www.chn.org/takeaction/index.html","",0,18,160);
Menu4_2=new Array("Sign Up for CHN Emails","http://www.chn.org/signUp.jsp","",0);
Menu4_3=new Array("Upcoming Events","http://www.chn.org/events/index.html","",0);
Menu4_4=new Array("Make a Donation","https://secure.democracyinaction.org/dia/organizations/chn/shop/custom.jsp?donate_page_KEY=11","",0);

Menu5=new Array("Human Needs Jobs","http://www.chn.org/jobs/index.html","",0,15,125);

http://farm4.static.flickr.com/3094/2689653919_89e71c96ab.jpg?v=0

Here is the new code and screenshot:

/* (c) Ger Versluis 2000 version 5 October 9th 2001 */

var NoOffFirstLineMenus=5; // Number of first level items
var LowBgColor='#006633'; // Background color when mouse is not over
var LowSubBgColor='#006633'; // Background color when mouse is not over on subs
var HighBgColor='black'; // Background color when mouse is over
var HighSubBgColor='black'; // Background color when mouse is over on subs
var FontLowColor='white'; // Font color when mouse is not over
var FontSubLowColor='white'; // Font color subs when mouse is not over
var FontHighColor='white'; // Font color when mouse is over
var FontSubHighColor='white'; // Font color subs when mouse is over
var BorderColor='#336633'; // Border color
var BorderSubColor='black'; // Border color for subs
var BorderWidth=1; // Border width
var BorderBtwnElmnts=1; // Border between elements 1 or 0
var FontFamily="Arial, Helvetica, sans-serif"; // Font family menu items
var FontSize=10; // Font size menu items
var FontBold=0; // Bold menu items 1 or 0
var FontItalic=0; // Italic menu items 1 or 0
var MenuTextCentered='left'; // Item text position 'left', 'center' or 'right'
var MenuCentered='center'; // Menu horizontal position 'left', 'center' or 'right'
var MenuVerticalCentered='top'; // Menu vertical position 'top', 'middle' or 'bottom'
var ChildOverlap=.2; // horizontal overlap child/ parent
var ChildVerticalOverlap=.2; // vertical overlap child/ parent
var StartTop=68; // Menu offset x coordinate
var StartLeft=0; // Menu offset y coordinate
var VerCorrect=0; // Multiple frames y correction
var HorCorrect=0; // Multiple frames x correction
var LeftPaddng=2; // Left padding
var TopPaddng=0; // Top padding
var FirstLineHorizontal=1; // First level items layout horizontal 1 or 0
var MenuFramesVertical=0; // Frames in cols or rows 1 or 0
var DissapearDelay=1000; // delay before menu folds in
var TakeOverBgColor=1; // Menu frame takes over background color subitem frame
var FirstLineFrame='navig'; // Frame where first level appears
var SecLineFrame='space'; // Frame where sub levels appear
var DocTargetFrame='space'; // Frame where target documents appear
var TargetLoc=''; // DIV id for relative positioning (refer to config.htm for info)
var HideTop=0; // Hide first level when loading new document 1 or 0
var MenuWrap=1; // enables/ disables menu wrap 1 or 0
var RightToLeft=0; // enables/ disables right to left unfold 1 or 0
var UnfoldsOnClick=0; // Level 1 unfolds onclick/ onmouseover
var WebMasterCheck=0; // menu tree checking on or off 1 or 0
var ShowArrow=1; // Uses arrow gifs when 1
var KeepHilite=1; // Keep selected path highligthed
var Arrws=['http://www.chn.org/images/tri.gif',5,10,'http://www.chn.org/images/spacer.gif',10,5,'http://www.chn.org/images/trileft.gif',5,10]; // Arrow source, width and height

function BeforeStart(){return}
function AfterBuild(){return}
function BeforeFirstOpen(){return}
function AfterCloseAll(){return}

// Menu tree
// MenuX=new Array(Text to show, Link, background image (optional), number of sub elements, height, width);
// For rollover images set "Text to show" to: "rollover:Image1.jpg:Image2.jpg"

Menu1=new Array("About CHN","http://www.chn.org/about/index.html","",6,15,150);
Menu1_1=new Array(" Board of Directors","http://www.chn.org/about/board.html","",0,18,150);
Menu1_2=new Array(" Membership","http://www.chn.org/about/membership.html","",0);
Menu1_3=new Array(" Internships at CHN","http://www.chn.org/jobs/internships.html","",0);
Menu1_4=new Array(" Support CHN","https://secure.democracyinaction.org/dia/organizations/chn/shop/custom.jsp?donate_page_KEY=11","",0);
Menu1_5=new Array(" CHN Staff","http://www.chn.org/about/staff.html","",0);
Menu1_6=new Array(" Contact Us","http://www.chn.org/about/contact.html","",0);

Menu2=new Array("Issues","http://www.chn.org/issues","",14,15,140);

Menu2_1=new Array("Block Grants","http://www.chn.org/issues/blockgrants/","",0,18,275);

Menu2_2=new Array("Budget and Appropriations","http://www.chn.org/issues/budget/","",1,18,275);

Menu2_2_1=new Array("Making Better Budget Choices","http://www.chn.org/issues/budgetchoices/index.html","",0,18,275);

Menu2_3=new Array("Disabilities","http://www.chn.org/issues/disabilities/","",1,18,275);

Menu2_3_1=new Array("Individuals with Disabilities Education Act (IDEA)","http://www.chn.org/issues/idea/","",0,18,300);

Menu2_4=new Array("Economy","http://www.chn.org/issues/economy/index.html","",0,18,275);

Menu2_5=new Array("Education and Youth Policy","http://www.chn.org/issues/education/","",3,18,275);

Menu2_5_1=new Array("Head Start","http://www.chn.org/issues/headstart/","",0,18,300);

Menu2_5_2=new Array("Individuals with Disabilities Education Act (IDEA)","http://www.chn.org/issues/idea/","",0);

Menu2_5_3=new Array("Juvenile Justice","http://www.chn.org/issues/juvenilejustice/","",0);

Menu2_6=new Array("Food and Nutrition","http://www.chn.org/issues/foodandnutrition/","",2,18,275);

Menu2_6_1=new Array("Child Nutrition","http://www.chn.org/issues/childnutrition/","",0,18,250);

Menu2_6_2=new Array("SNAP","http://www.chn.org/issues/foodstamps/","",0);

Menu2_7=new Array("Health","http://www.chn.org/issues/health/","",3,18,275);

Menu2_7_1=new Array("Medicaid","http://www.chn.org/issues/medicaid/","",0,18,300);

Menu2_7_2=new Array("Medicare","http://www.chn.org/issues/medicare/","",0);

Menu2_7_3=new Array("The Uninsured","http://www.chn.org/issues/uninsured/","",0);

Menu2_8=new Array("Housing and Homelessness","http://www.chn.org/issues/housing/","",2,18,275);

Menu2_8_1=new Array("Housing Crisis and Foreclosures","http://www.chn.org/issues/foreclosures/index.html","",0,18,335);

Menu2_8_2=new Array("Low Income Home Energy Assistance Program (LIHEAP)","http://www.chn.org/issues/liheap/","",0,18,335);

Menu2_9=new Array("Statistics on Human Needs","http://www.chn.org/issues/statistics/","",1,18,275);

Menu2_9_1=new Array("State-by-State Data","http://www.chn.org/issues/statistics/state.html","",0,18,200);

Menu2_10=new Array("Immigration","http://www.chn.org/issues/immigrants/","",0,18,275);

Menu2_11=new Array("Labor and Employment","http://www.chn.org/issues/labor/","",3,18,275);


Menu2_11_2=new Array("Job Training and Education","http://www.chn.org/issues/jobtraining/","",0);

Menu2_11_3=new Array("Minimum Wage","http://www.chn.org/issues/minimumwage/","",0);

Menu2_11_4=new Array("Unemployment Insurance (UI)","http://www.chn.org/issues/ui/","",0);


Menu2_12=new Array("Poverty","http://www.chn.org/issues/poverty/index.html","",1,18,275);

Menu2_12_1=new Array("Half in Ten Campaign","http://www.halfinten.org/","",0,18,275);

Menu2_13=new Array("Social Security","http://www.chn.org/issues/socialsecurity/","",0,18,275);

Menu2_14=new Array("Social Services","http://www.chn.org/issues/socialservices/","",3,18,275);

Menu2_14_1=new Array("Child Care","http://www.chn.org/issues/childcare/","",0,18,275);

Menu2_14_2=new Array("Child Protection, Foster Care and Adoption","http://www.chn.org/issues/adoption/","",0);

Menu2_14_3=new Array("Social Services Block Grant (SSBG)","http://www.chn.org/issues/ssbg/","",0);

Menu2_15=new Array("Tax Policy","http://www.chn.org/issues/taxpolicy/","",0,18,275);

Menu2_16=new Array("Income Support","http://www.chn.org/issues/welfare/","",4,18,275);

Menu2_16_1=new Array("Child Support","http://www.chn.org/issues/childsupport/index.html","",0,18,335);

Menu2_16_2=new Array("Low Income Home Energy Assistance Program (LIHEAP)","http://www.chn.org/issues/liheap/","18",335);

Menu2_16_3=new Array("Supplemental Security Income","http://www.chn.org/issues/ssi/index.html","",0,18,335);

Menu2_16_4=new Array("Temporary Assistance for Needy Families (TANF)","http://www.chn.org/issues/tanf/","",0,18,335);




Menu3=new Array("Publications","#","",3,15,165);

Menu3_1=new Array(" Human Needs Report","http://www.chn.org/humanneeds/index.html","",0,18,165);
Menu3_2=new Array(" CHN Analyses","http://www.chn.org/analyses/","",0);
Menu3_1=new Array(" Audio Briefings","http://www.chn.org/audio/index.html","",0,18,165);



Menu4=new Array("Take Action","http://www.chn.org/takeaction/index.html","",4,15,160);
Menu4_1=new Array("Action Alerts","http://www.chn.org/takeaction/index.html","",0,18,160);
Menu4_2=new Array("Sign Up for CHN Emails","http://www.chn.org/signUp.jsp","",0);
Menu4_3=new Array("Upcoming Events","http://www.chn.org/events/index.html","",0);
Menu4_4=new Array("Make a Donation","https://secure.democracyinaction.org/dia/organizations/chn/shop/custom.jsp?donate_page_KEY=11","",0);

Menu5=new Array("Human Needs Jobs","http://www.chn.org/jobs/index.html","",0,15,125);

http://farm4.static.flickr.com/3281/2690465832_7065146e43.jpg?v=0

Any help anyone can offer is much appreciated.

abduraooft
07-22-2008, 09:07 AM
It's not a good practice to use a javascript based menu, as it has many drawbacks.
Main problems is, no one will see this menu, if there is no javascrips support in their browser. And search engines can't index them as well.

I'd suggest a CSS based menu instead, see http://htmldog.com/articles/suckerfish/dropdowns/