473,245 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,245 software developers and data experts.

HELP WITH + AND - ==> Menu tree issue

1
Folks Please help this is driving me insane
The + expands but the minus fails

Error src is null or not an object

Expand|Select|Wrap|Line Numbers
  1. function Win_onLoad()
  2. {
  3.     GetNameAndLink(0);
  4. }
  5. function GetNameAndLink(pkId)
  6. {
  7.     var myMenu = eval("menuHolder" + pkId);
  8.     if(myMenu.innerHTML != "")
  9.         return;
  10.  
  11.  
  12.     var menus = xmlResponse.selectNodes("MenuItems/MenuItem");
  13.  
  14.     var table = "";
  15.  
  16.     for(i = 0; i< menus.length; i++)
  17.     {
  18.  
  19.         var itemId = menus[i].selectSingleNode("ItemId").text;
  20.         var menuTitle = menus[i].selectSingleNode("MenuTitle").text;
  21.         var menuLink = menus[i].selectSingleNode("MenuLink").text;
  22.         var hasChildren = menus[i].selectSingleNode("HasChildren").text;
  23.         var menuLevel = menus[i].selectSingleNode("MenuLevel").text;
  24.  
  25.         var menuIndent = (menuLevel - 1) * 24 + 2;
  26.  
  27.         var menuItem = "";
  28.  
  29.         if(hasChildren == "True")
  30.         {
  31.             menuItem = '<DIV id=menuIMG0 style="CURSOR: default" noWrap><IMG onMouseOver="menuOver(\'N0' + itemId + '\')" onMouseOut="menuOff(\'N0' + itemId + '\')" class=collapse id=ExpImg' + itemId + ' style="LEFT: ' + menuIndent +'px; POSITION: relative; TOP: 4px" onclick=Expando(' + itemId + ') alt="' + menuTitle +'" src="Images/plus.gif"><SPAN class=menulabel id=N0' + itemId + '  name=N0' + itemId + ' title="' + menuTitle +'" style="LEFT: ' + menuIndent +'px; POSITION: relative" onclick=Expando(' + itemId + ')  onMouseOver="menuOver(\'N0' + itemId + '\')" onMouseOut="menuOff(\'N0' + itemId + '\')" >' + menuTitle +'</SPAN></DIV>';
  32.             menuItem += '<DIV class=childContainer id=menuHolder' + itemId + ' style="DISPLAY: inline"></DIV>'
  33.         }
  34.         else
  35.         {
  36.             menuItem = '<DIV id=menuIMG0 style="CURSOR: default" noWrap><IMG onMouseOver="menuOver(\'N0' + itemId + '\')" onMouseOut="menuOff(\'N0' + itemId + '\')" class=collapse id=E0 style="LEFT: ' + menuIndent +'px; POSITION: relative; TOP: 4px" onclick="OpenItem(\'' + menuLink +'\', \'N0' + itemId + '\')" alt="' + menuTitle +'" src="Images/reporticon_big.gif"><SPAN class=menulabel id=N0' + itemId + '  name=N0' + itemId + ' title="' + menuTitle +'" style="LEFT: ' + menuIndent +'px; POSITION: relative" onclick="OpenItem(\'' + menuLink +'\', \'N0' + itemId + '\')" onMouseOver="menuOver(\'N0' + itemId + '\')" onMouseOut="menuOff(\'N0' + itemId + '\')" >' + menuTitle +'</SPAN></DIV>';
  37.  
  38.         }
  39.  
  40.         table += menuItem;
  41.     }
  42.  
  43.     myMenu.innerHTML = table;
  44. }
  45.  
  46. function OpenItem(menuLink, menuItem)
  47. {
  48.     if(selectedId != "")
  49.     {
  50.         document.getElementsByName(selectedId)[0].className='menulabel';
  51.     }
  52.     selectedId = menuItem;
  53.     document.getElementsByName(selectedId)[0].className='menulabelon';
  54.  
  55.     //parent.main.navigate(menuLink);
  56.     parent.frames["main"].location = menuLink;
  57. }
  58.  
  59. function Expando(itemId)
  60. {
  61.     var menuImage = eval("ExpImg" + itemId);
  62.     var childDiv = eval("menuHolder" + itemId);
  63.  
  64.     if(menuImage.src.indexOf('plus') > 0)
  65.     {
  66.         menuImage.src = "Images/minus.gif";
  67.         childDiv.style.display = "";
  68.         GetNameAndLink(itemId);
  69.     }
  70.     else
  71.     {
  72.         menuImage.src = "Images/plus.gif";
  73.         childDiv.style.display = "none";
  74.     }
  75. }
  76.  
  77. function menuOver(menuItem)
  78. {
  79.  
  80.     var oWorkItem;
  81.     oWorkItem = menuItem;
  82.  
  83.     document.getElementsByName(oWorkItem)[0].className='menulabelon';
  84.  
  85. }
  86.  
  87.  
  88. function menuOff(menuItem)
  89. {
  90.     var oWorkItem
  91.     oWorkItem = menuItem
  92.  
  93.      if (document.getElementsByName(oWorkItem)[0].className == "menulabelon" && oWorkItem != selectedId)
  94.      {
  95.          document.getElementsByName(oWorkItem)[0].className='menulabel';
  96.      }
  97.  
  98. }
  99.  
  100.  
  101. </script>
  102. </head>
  103. <BODY topmargin="0" leftmargin="0" style="OVERFLOW: auto;border-right: solid 1px black" bgcolor="#FAFAFF"  onLoad="Win_onLoad()" onhelp="OpenTrackerHelpFromOtherFrames(); return false;">
  104. <table border="0" height="24" width="100%" cellpadding="0" cellspacing="0">
  105.     <tr style="height: 25px">
  106.         <td class="filterHead" id="tdTitle" width="100%" style='padding-left:5px;font-weight:bold;'>
  107.             TrackerSuite.Net
  108.         </td>
  109.     </tr>
  110. </table>
  111. <table width="100%" border="0" cellpadding="0" cellspacing="0" class="filterUpperBorder" >
  112.     <tr style="height: 1px">
  113.         <td><img src="http://bytes.com/images/1.gif" width="1" height="1"></td>
  114.     </tr>
  115. </table>
  116. <DIV id=menulabels style="padding-left:8px;padding-top:2px;">
  117.  
  118. <div id="menuHolder0" name="menuHolder0"></div>
  119.  
  120. </div><DIV id=mylabels style="padding-left:8px;padding-top:2px;"></DIV>
  121. <!--<OBJECT id=CookieScriptlet style="LEFT: 0px; TOP: 0px" type=text/x-scriptlet height=0
  122.     width=0 data=CookieManager.htm></OBJECT>-->
  123. </BODY>
  124. </HTML>
Apr 27 '09 #1
2 1910
RamananKalirajan
608 512MB
Can u please attach the necessary files (Images) for this. xmlResponse is null here.

Regards
Ramanan Kalirajan
Apr 28 '09 #2
acoder
16,027 Expert Mod 8TB
On line 7, you have
Expand|Select|Wrap|Line Numbers
  1. var myMenu = eval("menuHolder" + pkId);
Although this will not cause a problem in IE, it would in other browsers, so change it to:
Expand|Select|Wrap|Line Numbers
  1. var myMenu = document.getElementById("menuHolder" + pkId);
The error message suggests that it's not getting the correct object. At least provide the response (xmlResponse), so that the code is easy to test, or a link.
Apr 28 '09 #3

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

Similar topics

3
by: Angelos | last post by:
Hello there, I am trying to write a script that will create dynamically a menu from MySQL database. The database table is a product categories table and it has the folowing filed: category_id,...
2
by: Gregor Horvath | last post by:
Hi, Before I reinvent the wheel I`d like to ask if someone has done this before since I did not find an advice at Google. The goal is to create a dynamic Tree View in HTML. Say I have a...
2
by: Jo | last post by:
I don't know if this can be done.. But here is what i am trying to do... I have a tree menu on a frameless page. I have the menu on the right hand side and a CGI web form post on the left....
1
by: RWC | last post by:
Hey Folks! I'm having trouble with an asp page. First off, I'm new to the html / asp world, but not to software development. I'd like to minimize or "normalize" the site, so I'm trying to use...
0
by: Tree menu using XML | last post by:
I have one XML file that has nodes and sub node and each and every node has the attribute call visible if its value is true then diplay this node else don't display thid node, but this condition i...
4
by: Tarique Jawed | last post by:
Alright I needed some help regarding a removal of a binary search tree. Yes its for a class, and yes I have tried working on it on my own, so no patronizing please. I have most of the code working,...
2
by: Phill | last post by:
I've got a text based system currently opperating via telnet sessions that I'm thinking of doing graphically w/.Net but am not sure If I can reproduce the same benefits in Windows. Basically it...
66
by: genestarwing | last post by:
QUESTION: Write a program that opens and read a text file and records how many times each word occurs in the file. Use a binary search tree modified to store both a word and the number of times it...
24
by: Chris F.A. Johnson | last post by:
On 2008-07-09, Denis McMahon wrote: If the left-hand column contains any text, use em rather than px to size it. In CSS, less is more. Most problems are caused by specifying too much rather...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...

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.