User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 427,499 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,456 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 1051 | Replies: 3
Reply
Join Date: Jun 2006
Location: UK (Bristol)
Posts: 225
Reputation: Mushy-pea is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 1
Mushy-pea's Avatar
Mushy-pea Mushy-pea is offline Offline
Posting Whiz in Training

Is my code wrong or is Opera?

  #1  
Oct 31st, 2006
Hello everyone. A few weeks ago I finished programming a javascript drop down menu system for my website. When I had ironed out the bugs it worked fine in IE 6. Later I got Opera 9 on my computer and the menus don't work in it. In fact, my pages appear to "freeze" the javascript engine and no scripts on the page run (even ones that were there before I added the menu system). I also tried the pages in an app called Editplus 2. It is a text editor with a built in browser that will give details about Javascript errors on web pages (it found some on Daniweb). But no problem with my pages. I've included the script here:

  1. <script language="JavaScript" type="text/JavaScript">
  2. <!--
  3. function MM_preloadImages() { //v3.0
  4. var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
  5. var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
  6. if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
  7. }
  8.  
  9. function MM_swapImgRestore() { //v3.0
  10. var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
  11. }
  12.  
  13. function MM_findObj(n, d) { //v4.01
  14. var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
  15. d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  16. if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  17. for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  18. if(!x && d.getElementById) x=d.getElementById(n); return x;
  19. }
  20.  
  21. function MM_swapImage() { //v3.0
  22. var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
  23. if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
  24. }
  25. function menu(flag_mouse, which_menu){
  26. if (flag_mouse == 1)
  27. {
  28. if (which_menu == 0) {
  29. remove_menus();
  30. }
  31. else if (which_menu == 1 && flag1 == 1) {a = 1};
  32. else if (which_menu == 1 && flag1 != 1) {
  33. remove_menus();
  34. flag1 = 1;
  35. document.getElementById("menu1").style.zIndex="3";
  36. document.getElementById("menu1").style.visibility="visible";
  37. }
  38. else if (which_menu == 2 && flag2 == 1) {a = 1};
  39. else if (which_menu == 2 && flag2 != 1) {
  40. remove_menus();
  41. }
  42. else if (which_menu == 3 && flag3 == 1) {a = 1};
  43. else if (which_menu == 3 && flag3 != 1) {
  44. remove_menus();
  45. }
  46. else if (which_menu == 4 && flag4 == 1) {a = 1};
  47. else if (which_menu == 4 && flag4 != 1) {
  48. remove_menus();
  49. flag4 = 1;
  50. document.getElementById("menu4").style.zIndex="3";
  51. document.getElementById("menu4").style.visibility="visible";
  52. }
  53. else if (which_menu == 5 && flag5 == 1) {a = 1};
  54. else if (which_menu == 5 && flag5 != 1) {
  55. remove_menus();
  56. }
  57. else if (which_menu == 6 && flag6 == 1) {a = 1};
  58. else if (which_menu == 6 && flag6 != 1) {
  59. remove_menus();
  60. }
  61. else if (which_menu == 7 && flag7 == 1) {a = 1};
  62. else if (which_menu == 7 && flag7 != 1) {
  63. remove_menus();
  64. flag7 = 1;
  65. document.getElementById("menu7").style.zIndex="3";
  66. document.getElementById("menu7").style.visibility="visible";
  67. };
  68. }
  69. else if (flag_mouse == 0)
  70. {
  71. flag1 = 0; flag4 = 0; flag7 = 0;
  72. document.getElementById("menu1").style.zIndex="0";
  73. document.getElementById("menu1").style.visibility="hidden";
  74. document.getElementById("menu4").style.zIndex="0";
  75. document.getElementById("menu4").style.visibility="hidden";
  76. document.getElementById("menu7").style.zIndex="0";
  77. document.getElementById("menu7").style.visibility="hidden";
  78. };
  79. }
  80. function remove_menus() {
  81. document.getElementById("menu1").style.zIndex="0";
  82. document.getElementById("menu1").style.visibility="hidden";
  83. document.getElementById("menu4").style.zIndex="0";
  84. document.getElementById("menu4").style.visibility="hidden";
  85. document.getElementById("menu7").style.zIndex="0";
  86. document.getElementById("menu7").style.visibility="hidden";
  87. flag1 = 0; flag4 = 0; flag7 = 0;
  88. }
  89. </script>

You can find the whole pages on my homepage. So what do you think, am I stupid or is Opera? Any advice appriciated.

Steven.
Last edited by Mushy-pea : Oct 31st, 2006 at 9:29 am.
Hello, you're through to Steven on the BT Business technical help desk. Could I take your broadband telephone number please?
AddThis Social Bookmark Button
Reply With Quote  
Join Date: May 2006
Location: New Jersey
Posts: 1,422
Reputation: stymiee is on a distinguished road 
Rep Power: 5
Solved Threads: 34
Moderator
stymiee's Avatar
stymiee stymiee is offline Offline
He's No Good To Me Dead

Re: Is my code wrong or is Opera?

  #2  
Oct 31st, 2006
To help troubleshoot this I would suggest removing portions of code until you are able to narrow it down to a small snippet that is causing the error. That will make troubleshooting much easier.
John Conde
Brainyminds | Merchant Account Services | I Love Code
IT'S HERE: Merchant Accounts 101 Everything you need to know about merchant accounts!
Reply With Quote  
Join Date: Oct 2006
Posts: 5
Reputation: rachaelmom is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
rachaelmom rachaelmom is offline Offline
Newbie Poster

Re: Is my code wrong or is Opera?

  #3  
Oct 31st, 2006
I'm having the same type of problem with Opera and a CSS/javascript menu. I don't know the answer but it is happening to me as well. Works fine with all other browsers.
Reply With Quote  
Join Date: Oct 2006
Location: Sofia, Bulgaria
Posts: 135
Reputation: Rhyan is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 7
Rhyan's Avatar
Rhyan Rhyan is offline Offline
Junior Poster

Re: Is my code wrong or is Opera?

  #4  
Nov 2nd, 2006
Can I see the code in action on your page. I have a Drop Down / css menu on one of my pages that works fine in Opera as well, so you can just redesign it for your need.

I just want to see yours. Post a link, pls.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb JavaScript / DHTML / AJAX Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum

All times are GMT -4. The time now is 7:07 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC