Solved

Problem with menu display.....

Posted on 2006-06-23
3
325 Views
Last Modified: 2008-02-01
In my ASP.Net 1.1 C# application, I am generating a menu dynamically and adding it as
text in a literal control.  However, the code is not working.  I am getting a
"document is null[...] or not an object " page error.

Please take a look at what is generated and let me know if you see the cause.
Thanks!

This is the menu item the drop downs are generated for:

<A onmouseover="switchImage('nav8','navOn[8]');MM_showMenu(window.mm_menu_testimonials,<%=JavaMenuX%>,<%=JavaMenuY%>,null,'testimonials');" onmouseout="switchImage('nav8','navOff[8]');MM_startTimeout();" href="#">
      <img height=30 id="testimonials" name="testimonials" src='<%= ResolveUrl("~/Images/nav_testimonials_off.jpg") %>' width=129 border=0 >
</A>

This is the generated menu code:

<script>window.mm_menu_testimonials = new Menu("testimonials",150,20,'verdana','10','#671215','#000000','#faf0e6','#f8ede4','left','middle',  3,  0,  1000,  0,  0,true,false,true,3  ,true,true);
            mm_menu_testimonials.addMenuItem("Mission","location='/content/Mission.aspx'");
            mm_menu_testimonials.bgColor='#FFFFFF';
            mm_menu_testimonials.hideOnMouseOut=true;
            mm_menu_testimonials.menuBorder=0;
            mm_menu_testimonials.menuLiteBgColor='#FFFFFF';
            mm_menu_testimonials.menuBorderBgColor='#FFFFFF';
            mm_menu_testimonials.addMenuItem("Management","location='/content/Management.aspx'");
            mm_menu_testimonials.bgColor='#FFFFFF';
            mm_menu_testimonials.hideOnMouseOut=true;
            mm_menu_testimonials.menuBorder=0;
            mm_menu_testimonials.menuLiteBgColor='#FFFFFF';
            mm_menu_testimonials.menuBorderBgColor='#FFFFFF';
            mm_menu_testimonials.addMenuItem("Careers","location='/content/Careers.aspx'");
            mm_menu_testimonials.bgColor='#FFFFFF';
            mm_menu_testimonials.hideOnMouseOut=true;
            mm_menu_testimonials.menuBorder=0;
            mm_menu_testimonials.menuLiteBgColor='#FFFFFF';
            mm_menu_testimonials.menuBorderBgColor='#FFFFFF';
            mm_menu_testimonials.addMenuItem("ContactUs","location='/ContactUs.aspx'");
            mm_menu_testimonials.bgColor='#FFFFFF';
            mm_menu_testimonials.hideOnMouseOut=true;
            mm_menu_testimonials.menuBorder=0;
            mm_menu_testimonials.menuLiteBgColor='#FFFFFF';
            mm_menu_testimonials.menuBorderBgColor='#FFFFFF';writeMenu();</script>
0
Comment
Question by:JeffDrummond
3 Comments
 

Author Comment

by:JeffDrummond
ID: 16971262
I found one problem.  The name being specified in the switchImage was incorrect.  
I changed nav8 to the name of the image and that works again.

Now I have an "object expected" error.

This is my updated code:

<A onmouseover="switchImage('about','navOn[11]');MM_showMenu(window.mm_menu_about,<%=JavaMenuX%>,<%=JavaMenuY%>,null,'about');" onmouseout="switchImage('about','navOff[11]');" href="#" >
                        <img id="about" name="about" height=30 src='<%= ResolveUrl("~/Images/nav_about_off.jpg") %>' width=79 border=0></A>

<script>window.mm_menu_about = new Menu("about",150,20,'verdana','10','#671215','#000000','#faf0e6','#f8ede4','left','middle',  3,  0,  1000,  0,  0,true,false,true,3  ,true,true);
            mm_menu_about.addMenuItem("Mission","location='/content/Mission.aspx'");
            mm_menu_about.bgColor='#FFFFFF';
            mm_menu_about.hideOnMouseOut=true;
            mm_menu_about.menuBorder=0;
            mm_menu_about.menuLiteBgColor='#FFFFFF';
            mm_menu_about.menuBorderBgColor='#FFFFFF';
            mm_menu_about.addMenuItem("Management","location='/content/Management.aspx'");
            mm_menu_about.bgColor='#FFFFFF';
            mm_menu_about.hideOnMouseOut=true;
            mm_menu_about.menuBorder=0;
            mm_menu_about.menuLiteBgColor='#FFFFFF';
            mm_menu_about.menuBorderBgColor='#FFFFFF';
            mm_menu_about.addMenuItem("Careers","location='/content/Careers.aspx'");
            mm_menu_about.bgColor='#FFFFFF';
            mm_menu_about.hideOnMouseOut=true;
            mm_menu_about.menuBorder=0;
            mm_menu_about.menuLiteBgColor='#FFFFFF';
            mm_menu_about.menuBorderBgColor='#FFFFFF';
            mm_menu_about.addMenuItem("ContactUs","location='/ContactUs.aspx'");
            mm_menu_about.bgColor='#FFFFFF';
            mm_menu_about.hideOnMouseOut=true;
            mm_menu_about.menuBorder=0;
            mm_menu_about.menuLiteBgColor='#FFFFFF';
            mm_menu_about.menuBorderBgColor='#FFFFFF';writeMenu();</script>
0
 
LVL 30

Expert Comment

by:callrs
ID: 16971448
'navOn[11]' --> navOn[11]

Do you need quotes? I know Javascript, not ASP, but I doubt quotes is valid for arrays..
0
 
LVL 17

Accepted Solution

by:
gops1 earned 500 total points
ID: 16974044
Can you put the generated source for this line:

<A onmouseover="switchImage('nav8','navOn[8]');MM_showMenu(window.mm_menu_testimonials,<%=JavaMenuX%>,<%=JavaMenuY%>,null,'testimonials');" onmouseout="switchImage('nav8','navOff[8]');MM_startTimeout();" href="#">
     <img height=30 id="testimonials" name="testimonials" src='<%= ResolveUrl("~/Images/nav_testimonials_off.jpg") %>' width=129 border=0 >
</A>

or try putting qoutes for you java variables:

<A onmouseover="switchImage('nav8','navOn[8]');MM_showMenu(window.mm_menu_testimonials,"<%=JavaMenuX%>","<%=JavaMenuY%>",null,'testimonials');" onmouseout="switchImage('nav8','navOff[8]');MM_startTimeout();" href="#">
     <img height=30 id="testimonials" name="testimonials" src='<%= ResolveUrl("~/Images/nav_testimonials_off.jpg") %>' width=129 border=0 >
</A>
0

Featured Post

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Avoid defining the variables in the global scope; trying to define them in a local function scope. Because:   • Look-up is performed every time a variable is accessed.   • Variables are resolved backwards from most specific to least specific scope…
In this article, we'll look how to sort an Array in JavaScript, including the more advanced techniques of sorting a collection of records either ascending or descending on two or more fields. Basic Sorting of Arrays First, let's look at the …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question