473,396 Members | 1,892 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,396 software developers and data experts.

Dynamic folding menu not working in Firefox 2

7
This code does not seem to work in Firefox 2. Does anybody know why?

thanks,
Paul

Expand|Select|Wrap|Line Numbers
  1. var Op8=window.opera
  2. var ns6Op8=(document.getElementById&&!document.all)||Op8
  3. var ie4=document.all&&!Op8
  4. function fncheckcontained<%=lintGadgetID%>(e)
  5. {
  6.     var lblncontained;            // Boolean Variable to hold the status of the ID
  7.     var lstrCurrentItem;            //Variable to hole current Item.
  8.     var lstrfoldercontent;        //Variable to hole folder content.
  9.     lblncontained=0;
  10.     lstrCurrentItem=ns6Op8? e.target : event.srcElement;
  11.     alert('lstrCurrentItem.id:' + lstrCurrentItem.id);
  12.  
  13.     if (lstrCurrentItem.id=="foldheaderTreeView")
  14.     {
  15.         alert('id==foldheaderTreeView');
  16.         lblncontained=1;
  17.     }
  18.     else
  19.         while (ns6Op8&&lstrCurrentItem.parentNode||(ie4&&lstrCurrentItem.parentElement))
  20.             {
  21.                 alert('in loop:' + lstrCurrentItem.id);
  22.                 if (lstrCurrentItem.id=="foldheaderTreeView"||lstrCurrentItem.id=="foldinglistTreeView")
  23.                     {
  24.                         lblncontained=(lstrCurrentItem.id=="foldheaderTreeView")? 1 : 0
  25.                         break;
  26.                     }
  27.                 lstrCurrentItem=ns6Op8? lstrCurrentItem.parentNode : lstrCurrentItem.parentElement
  28.             }
  29.  
  30.     if (lblncontained)
  31.         {
  32.             lstrfoldercontent=ns6Op8? lstrCurrentItem.nextSibling.nextSibling : lstrCurrentItem.all.tags("UL")[0]
  33.             alert('lstrfoldercontent.style.display:' + lstrfoldercontent.style.display);
  34.             if (lstrfoldercontent.style.display=="none")
  35.                 {
  36.                     lstrfoldercontent.style.display="none"
  37.                     lstrCurrentItem.style.listStyleImage="url(../Images/minus.gif)"
  38.                 }
  39.             else
  40.                 {
  41.                     lstrfoldercontent.style.display="none"
  42.                     lstrCurrentItem.style.listStyleImage="url(../Images/plus.gif)"
  43.                 }
  44.         }
  45.     event.cancelBubble = true;        
  46. }
  47.  
Nov 21 '07 #1
5 1515
Logician
210 100+
Expand|Select|Wrap|Line Numbers
  1. var Op8=window.opera
  2. var ns6Op8=(document.getElementById&&!document.all)||Op8
  3. var ie4=document.all&&!Op8
You'll need to post a test page before anyone delves into that, but I would steer clear of any code that uses the detection above.
Nov 22 '07 #2
hd181a
7
How do I post a test page. This in an intranet application.

Thanks,
Paul
You'll need to post a test page before anyone delves into that, but I would steer clear of any code that uses the detection above.
Nov 22 '07 #3
acoder
16,027 Expert Mod 8TB
Don't use browser detection - see link.

Use object/feature detection instead.

You could easily replace the ns6Op8 with the actual support you are checking for, i.e. parentNode and parentElement.

event.cancelBubble is non-standard and IE-only. The standard stopPropogation() will not work in IE, so you have to use both.
Nov 22 '07 #4
hd181a
7
You'll need to post a test page before anyone delves into that, but I would steer clear of any code that uses the detection above.
Here is a standalone version of the code:

[HTML]<html>
<body>
<STYLE>#foldheaderTreeView{cursor:pointer;cursor:h and ;
list-style-image: url('https://eportal-gad5-dev.ca.boeing.com/gs5/BCACore/Treeview/Images/plus.gif');
margin-left: -20px }
#foldheaderListTreeView{cursor:pointer;cursor:hand ;
list-style-image: url('https://eportal-gad5-dev.ca.boeing.com/gs5/BCACore/Treeview/Images/minus.gif');
margin-left: -20px }
#foldinglistTreeView{list-style-image: url('https://eportal-gad5-dev.ca.boeing.com/gs5/BCACore/Treeview/Images/minus.gif')} </STYLE>


<SCRIPT language="javascript">
[/HTML]
Expand|Select|Wrap|Line Numbers
  1.     var Op8=window.opera
  2.     var ns6Op8=(document.getElementById&&!document.all)||Op8
  3.     var ie4=document.all&&!Op8
  4.  
  5.     /*************************************************************************
  6.     Function Name                :    fncheckcontained
  7.     Description                    :    function called on click of the Item details.
  8.     Input Parameters            :    e - Event Clicked
  9.     Returned Values            :    None
  10.     *************************************************************************/
  11.     function fncheckcontained(e)
  12.         {
  13.             var lblncontained;            // Boolean Variable to hold the status of the ID
  14.             var lstrCurrentItem;            //Variable to hole current Item.
  15.             var lstrfoldercontent;        //Variable to hole folder content.
  16.             lblncontained=0;
  17.             lstrCurrentItem=ns6Op8? e.target : event.srcElement;
  18.             //alert('lstrCurrentItem.id:' + lstrCurrentItem.id);
  19.  
  20.             if (lstrCurrentItem.id=="foldheaderTreeView")
  21.             {
  22.                 //alert('id==foldheaderTreeView');
  23.                 lblncontained=1;
  24.             }
  25.             else
  26.                 while (ns6Op8&&lstrCurrentItem.parentNode|| (ie4&&lstrCurrentItem.parentElement))
  27.                     {
  28.                         //alert('in loop:' + lstrCurrentItem.id);
  29.                         if (lstrCurrentItem.id=="foldheaderTreeView"|| lstrCurrentItem.id=="foldinglistTreeView")
  30.                             {
  31.                                 lblncontained=(lstrCurrentItem.id=="foldheaderTreeView")? 1 : 0
  32.                                 break;
  33.                             }
  34.                         lstrCurrentItem=ns6Op8? lstrCurrentItem.parentNode : lstrCurrentItem.parentElement
  35.                     }
  36.  
  37.             if (lblncontained)
  38.                 {
  39.                     lstrfoldercontent=ns6Op8? lstrCurrentItem.nextSibling.nextSibling : lstrCurrentItem.all.tags("UL")[0]
  40.                     //alert('lstrfoldercontent.style.display:' + lstrfoldercontent.style.display);
  41.                     if (lstrfoldercontent.style.display=="none")
  42.                         {
  43.                             lstrfoldercontent.style.display=""
  44.                             // Ver 1$ Start
  45.                             lstrCurrentItem.style.listStyleImage= "url(https://eportal-gad5-dev.ca.boeing.com/gs5/BCACore/Treeview/Images/minus.gif)"
  46.                             // Ver 1$ End
  47.                         }
  48.                     else
  49.                         {
  50.                             lstrfoldercontent.style.display="none"
  51.                             // Ver 1$ Start
  52.                             lstrCurrentItem.style.listStyleImage= "url(https://eportal-gad5-dev.ca.boeing.com/gs5/BCACore/Treeview/Images/plus.gif)"
  53.                             // Ver 1$ End
  54.                         }
  55.                 }
  56.             event.cancelBubble = true;
  57.         }
  58.     function fnNewWindow(lstrurl,ablnWindowStatus)
  59.     {
  60.         var lstrPageName;   //variable to hold Page name.
  61.         var lstrnewWind;      //variable to hold Window status.
  62.         var lstrPopupName;
  63.         var d = new Date();
  64.         lstrPageName = lstrurl;
  65.         if(lstrPageName.substring(0,3).toUpperCase()=="WWW")
  66.             lstrPageName = "http://"+lstrPageName;
  67.  
  68.         if    ((lstrPageName.substring(0,4).toUpperCase()!="HTTP")&& (lstrPageName.substring(0,4).toUpperCase()!="FILE"))
  69.             lstrPageName = "file:"+lstrPageName;
  70.         else if(lstrPageName.substring(0,4).toUpperCase()!="FILE")
  71.             lstrPageName = lstrPageName
  72.         if (ablnWindowStatus == 0)
  73.             document.location.href=lstrPageName;
  74.         else
  75.         {
  76.             var wLeft = 50 + 10 * Math.floor(Math.random()*50);
  77.             var wTop = 50 + 10 * Math.floor(Math.random()*50);
  78.             lstrPopupName = "New_Win" + d.getTime();
  79.             window.open(lstrPageName,lstrPopupName,"width=640,height=480,left=" + wLeft + ",top=" + wTop + ",toolbar=yes,status=yes,scrollbars=yes,resizable=yes,location=yes,menubar=yes,directories=yes");
  80.         }
  81.     }
[HTML]
</script>

<UL>
<LI id=foldheaderListTreeView onclick = "javascript:fncheckcontained(event);">
<U><A onclick="javascript:fnNewWindow('http://woot.com','1')" >test</A></U>
</LI>
<UL id=foldinglistTreeView style="DISPLAY: none; head: " onclick = "javascript:fncheckcontained(event);"> </UL>
<LI id=foldheaderTreeView onclick = "javascript:fncheckcontained(event);"><U><A onclick="javascript:fnNewWindow('http://www.boeing.com','1')" >boeing.com</A></U>
<UL id=foldinglistTreeView style="DISPLAY: none;head: " onclick = "javascript:fncheckcontained(event);">
<LI id=foldheaderListTreeView onclick = "javascript:fncheckcontained(event);"><U><A onclick="javascript:fnNewWindow('http://woot.com','1')" >Test</A></U>
</LI>
<UL id=foldinglistTreeView style="DISPLAY: none; head: " onclick = "javascript:fncheckcontained(event);"> </UL>
<LI id=foldheaderTreeView onclick = "javascript:fncheckcontained(event);"><U><A onclick="javascript:fnNewWindow('http://www.asp.net','1')" >ASP.NET</A></U>
<UL id=foldinglistTreeView style="DISPLAY: none;head: " onclick = "javascript:fncheckcontained(event);">
<LI id=foldheaderListTreeView onclick = "javascript:fncheckcontained(event);"><U><A onclick="javascript:fnNewWindow('http://www.usps.org','1')" >usps.org</A></U>
</LI>
<UL id=foldinglistTreeView style="DISPLAY: none; head: " onclick = "javascript:fncheckcontained(event);"> </UL>
</UL></LI><LI id=foldheaderListTreeView onclick = "javascript:fncheckcontained(event);" ><U><A onclick="javascript:fnNewWindow('http://www.ski.org','1')" >ski.org</A></U>
</LI>
<UL id=foldinglistTreeView style="DISPLAY: none; head: " onclick = "javascript:fncheckcontained(event);"> </UL>
</UL></LI><LI id=foldheaderListTreeView onclick = "javascript:fncheckcontained(event);" ><U><A onclick="javascript:fnNewWindow('http://inside.boeing.com','1')" >inside.boeing.com</A></U></LI><UL id=foldinglistTreeView style="DISPLAY: none; head: " onclick = "javascript:fncheckcontained(event);"> </UL><LI id=foldheaderListTreeView onclick = "javascript:fncheckcontained(event);"><U><A onclick="javascript:fnNewWindow('asdfasdf','1')" >asdfasdf</A></U></LI><UL id=foldinglistTreeView style="DISPLAY: none; head: " onclick = "javascript:fncheckcontained(event);"> </UL><LI id=foldheaderListTreeView onclick = "javascript:fncheckcontained(event);"><U><A onclick="javascript:fnNewWindow('http://www.cnn.com','1')" >cnn.com</A></U></LI><UL id=foldinglistTreeView style="DISPLAY: none; head: " onclick = "javascript:fncheckcontained(event);"> </UL><LI id=foldheaderListTreeView onclick = "javascript:fncheckcontained(event);"><U><A onclick="javascript:fnNewWindow('asdfadf','1')" >etwtwa</A></U></LI><UL id=foldinglistTreeView style="DISPLAY: none; head: " onclick = "javascript:fncheckcontained(event);"> </UL><LI id=foldheaderListTreeView onclick = "javascript:fncheckcontained(event);"><U><A onclick="javascript:fnNewWindow('http://www.foxnews.com','1')" >foxnews</A></U></LI>
<UL id=foldinglistTreeView style="DISPLAY: block;head: " onclick = "javascript:fncheckcontained(event);"> </UL>
</UL>
</body>
</html>[/HTML]
Nov 26 '07 #5
drhowarddrfine
7,435 Expert 4TB
Your markup is invalid with 45 html errors and two css errors. You are not allowed to use an id name more than once in a page. There is no such thing as 'cursor: hand'. You are missing a doctype. Attributes are to be enclosed in quotes. There is no such thing as "language=" and your <style> tag is incomplete. Plus whatever else is listed when you validate your html and css.
Nov 27 '07 #6

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

Similar topics

1
by: mike888 | last post by:
I want to create dynamic iframe content like below but in Firefox <iframe width="100%" height="100" src="#"></iframe> <script language="JavaScript"><!-- document.frames.document.open();...
0
by: Ryan H | last post by:
Hi, My ASP.NET 2.0 web page uses the Menu Control and the dynamic pop-up menu gets cut off when it overlaps content written in Flash. This only happens when the page is viewed using FireFox. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.