vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Java script navbar doesn't work, and causes entire site to 'freak out' (https://vborg.vbsupport.ru/showthread.php?t=117851)

lightnb 06-06-2006 11:44 PM

Java script navbar doesn't work, and causes entire site to 'freak out'
 
In my 'mast_head' template, after the main forum graphics, I have:

PHP Code:

$main_navbar 

Which is attached to a plugin, hooked at global_start, and contains the code:

PHP Code:

ob_start();
include(
'http://www.rahlentertainment.com/livexchange/forums/images/trapazoid/navbar_code.html');
$main_navbar ob_get_contents();
ob_end_clean(); 

Which should include my navbar, which is contained in the file 'navbar_code.html'

The contents of 'navbar_code.html' are:

HTML Code:

<script type="text/JavaScript">
<!--
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>
0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_nbGroup(event, grpName) { //v6.0
  var i,img,nbArr,args=MM_nbGroup.arguments;
  if (event == "init" && args.length >
2) {
    if ((img = MM_findObj(args[2])) != null && !img.MM_init) {
      img.MM_init = true; img.MM_up = args[3]; img.MM_dn = img.src;
      if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new Array();
      nbArr[nbArr.length] = img;
      for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
        if (!img.MM_up) img.MM_up = img.src;
        img.src = img.MM_dn = args[i+1];
        nbArr[nbArr.length] = img;
    } }
  } else if (event == "over") {
    document.MM_nbOver = nbArr = new Array();
    for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = (img.MM_dn && args[i+2]) ? args[i+2] : ((args[i+1])? args[i+1] : img.MM_up);
      nbArr[nbArr.length] = img;
    }
  } else if (event == "out" ) {
    for (i=0; i < document.MM_nbOver.length; i++) {
      img = document.MM_nbOver[i]; img.src = (img.MM_dn) ? img.MM_dn : img.MM_up; }
  } else if (event == "down") {
    nbArr = document[grpName];
    if (nbArr)
      for (i=0; i < nbArr.length; i++) { img=nbArr[i]; img.src = img.MM_up; img.MM_dn = 0; }
    document[grpName] = nbArr = new Array();
    for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = img.MM_dn = (args[i+1])? args[i+1] : img.MM_up;
      nbArr[nbArr.length] = img;
  } }
}
//-->

</script>
</head>

<body onload="MM_preloadImages('http://www.rahlentertainment.com/livexchange/forums/images/trapazoid/buttons/home_down.jpg','http://www.rahlentertainment.com/livexchange/forums/images/trapazoid/buttons/home_over.jpg','http://www.rahlentertainment.com/livexchange/forums/images/trapazoid/buttons/home_over_down.jpg','http://www.rahlentertainment.com/livexchange/forums/images/trapazoid/buttons/articles_down.jpg','http://www.rahlentertainment.com/livexchange/forums/images/trapazoid/buttons/articles_over.jpg','http://www.rahlentertainment.com/livexchange/forums/images/trapazoid/buttons/articles_over_down.jpg','http://www.rahlentertainment.com/livexchange/forums/images/trapazoid/buttons/tutorials_down.jpg','http://www.rahlentertainment.com/livexchange/forums/images/trapazoid/buttons/tutorials_over.jpg','http://www.rahlentertainment.com/livexchange/forums/images/trapazoid/buttons/tutorials_over_down.jpg','http://www.rahlentertainment.com/livexchange/forums/images/trapazoid/buttons/forums_down.jpg','http://www.rahlentertainment.com/livexchange/forums/images/trapazoid/buttons/forums_over.jpg','http://www.rahlentertainment.com/livexchange/forums/images/trapazoid/buttons/forums_over_down.jpg','http://www.rahlentertainment.com/livexchange/forums/images/trapazoid/buttons/gallery_down.jpg','http://www.rahlentertainment.com/livexchange/forums/images/trapazoid/buttons/gallery_over.jpg','http://www.rahlentertainment.com/livexchange/forums/images/trapazoid/buttons/gallery_over_down.jpg','http://www.rahlentertainment.com/livexchange/forums/images/trapazoid/buttons/people_down.jpg','http://www.rahlentertainment.com/livexchange/forums/images/trapazoid/buttons/people_over.jpg','http://www.rahlentertainment.com/livexchange/forums/images/trapazoid/buttons/people_over_down.jpg','http://www.rahlentertainment.com/livexchange/forums/images/trapazoid/buttons/equipment_down.jpg','http://www.rahlentertainment.com/livexchange/forums/images/trapazoid/buttons/equipment_over.jpg','http://www.rahlentertainment.com/livexchange/forums/images/trapazoid/buttons/equipment_over_down.jpg','http://www.rahlentertainment.com/livexchange/forums/images/trapazoid/buttons/tools_down.jpg','http://www.rahlentertainment.com/livexchange/forums/images/trapazoid/buttons/tools_over.jpg','http://www.rahlentertainment.com/livexchange/forums/images/trapazoid/buttons/tools_over_down.jpg','http://www.rahlentertainment.com/livexchange/forums/images/trapazoid/buttons/database_down.jpg','http://www.rahlentertainment.com/livexchange/forums/images/trapazoid/buttons/database_over.jpg','http://www.rahlentertainment.com/livexchange/forums/images/trapazoid/buttons/database_over_down.jpg','http://www.rahlentertainment.com/livexchange/forums/images/trapazoid/buttons/help_down.jpg','http://www.rahlentertainment.com/livexchange/forums/images/trapazoid/buttons/help_over.jpg','http://www.rahlentertainment.com/livexchange/forums/images/trapazoid/buttons/help_over_down.jpg')">
<table border="0" cellpadding="0" cellspacing="0" background="http://www.rahlentertainment.com/livexchange/forums/images/trapazoid/main_navbar.jpg">
    <tr>
       
       
        <td><img src="http://www.rahlentertainment.com/livexchange/forums/images/trapazoid/main_navbar_left_end.jpg" /></td>
         
                 
                 
                  <td><a href="#" target="_top" onclick="MM_nbGroup('down','group1','home','http://www.rahlentertainment.com/livexchange/forums/images/trapazoid/buttons/home_down.jpg',1)" onmouseover="MM_nbGroup('over','home','http://www.rahlentertainment.com/livexchange/forums/images/trapazoid/buttons/home_over.jpg','http://www.rahlentertainment.com/livexchange/forums/images/trapazoid/buttons/home_over_down.jpg',1)" onmouseout="MM_nbGroup('out')"><img src="http://www.rahlentertainment.com/livexchange/forums/images/trapazoid/buttons/home.jpg" alt="Home" name="home" width="61" height="24" border="0" id="home" onload="" /></a></td>
                 
                 
                 
                 
          <td><a href="#" target="_top" onclick="MM_nbGroup('down','group1','articles','http://www.rahlentertainment.com/livexchange/forums/images/trapazoid/buttons/articles_down.jpg',1)" onmouseover="MM_nbGroup('over','articles','http://www.rahlentertainment.com/livexchange/forums/images/trapazoid/buttons/articles_over.jpg','http://www.rahlentertainment.com/livexchange/forums/images/trapazoid/buttons/articles_over_down.jpg',1)" onmouseout="MM_nbGroup('out')"><img src="http://www.rahlentertainment.com/livexchange/forums/images/trapazoid/buttons/articles.jpg" alt="Articles" name="articles" width="76" height="24" border="0" id="articles" onload="" /></a></td>
                 
                 
                 
                 
          <td><a href="#" target="_top" onclick="MM_nbGroup('down','group1','Tutorials','http://www.rahlentertainment.com/livexchange/forums/images/trapazoid/buttons/tutorials_down.jpg',1)" onmouseover="MM_nbGroup('over','Tutorials','http://www.rahlentertainment.com/livexchange/forums/images/trapazoid/buttons/tutorials_over.jpg','http://www.rahlentertainment.com/livexchange/forums/images/trapazoid/buttons/tutorials_over_down.jpg',1)" onmouseout="MM_nbGroup('out')"><img src="http://www.rahlentertainment.com/livexchange/forums/images/trapazoid/buttons/tutorials.jpg" alt="Tutorials" name="Tutorials" width="86" height="24" border="0" id="Tutorials" onload="" /></a></td>
                 
                 
                 
                 
          <td><a href="#" target="_top" onclick="MM_nbGroup('down','group1','forums','http://www.rahlentertainment.com/livexchange/forums/images/trapazoid/buttons/forums_down.jpg',1)" onmouseover="MM_nbGroup('over','forums','http://www.rahlentertainment.com/livexchange/forums/images/trapazoid/buttons/forums_over.jpg','http://www.rahlentertainment.com/livexchange/forums/images/trapazoid/buttons/forums_over_down.jpg',1)" onmouseout="MM_nbGroup('out')"><img src="http://www.rahlentertainment.com/livexchange/forums/images/trapazoid/buttons/forums.jpg" alt="Forums" name="forums" width="70" height="24" border="0" id="forums" onload="" /></a></td>
                 
                 
                 
                 
          <td><a href="#" target="_top" onclick="MM_nbGroup('down','group1','gallery','http://www.rahlentertainment.com/livexchange/forums/images/trapazoid/buttons/gallery_down.jpg',1)" onmouseover="MM_nbGroup('over','gallery','http://www.rahlentertainment.com/livexchange/forums/images/trapazoid/buttons/gallery_over.jpg','http://www.rahlentertainment.com/livexchange/forums/images/trapazoid/buttons/gallery_over_down.jpg',1)" onmouseout="MM_nbGroup('out')"><img src="http://www.rahlentertainment.com/livexchange/forums/images/trapazoid/buttons/gallery.jpg" alt="Gallery" name="gallery" width="76" height="24" border="0" id="gallery" onload="" /></a></td>
                 
                 
                 
          <td><a href="#" target="_top" onclick="MM_nbGroup('down','group1','people','http://www.rahlentertainment.com/livexchange/forums/images/trapazoid/buttons/people_down.jpg',1)" onmouseover="MM_nbGroup('over','people','http://www.rahlentertainment.com/livexchange/forums/images/trapazoid/buttons/people_over.jpg','http://www.rahlentertainment.com/livexchange/forums/images/trapazoid/buttons/people_over_down.jpg',1)" onmouseout="MM_nbGroup('out')"><img src="http://www.rahlentertainment.com/livexchange/forums/images/trapazoid/buttons/people.jpg" alt="People" name="people" width="69" height="24" border="0" id="people" onload="" /></a></td>
                 
                 
                 
          <td><a href="#" target="_top" onclick="MM_nbGroup('down','group1','equipment','http://www.rahlentertainment.com/livexchange/forums/images/trapazoid/buttons/equipment_down.jpg',1)" onmouseover="MM_nbGroup('over','equipment','http://www.rahlentertainment.com/livexchange/forums/images/trapazoid/buttons/equipment_over.jpg','http://www.rahlentertainment.com/livexchange/forums/images/trapazoid/buttons/equipment_over_down.jpg',1)" onmouseout="MM_nbGroup('out')"><img src="http://www.rahlentertainment.com/livexchange/forums/images/trapazoid/buttons/equipment.jpg" alt="Equipment" name="equipment" width="88" height="24" border="0" id="equipment" onload="" /></a></td>
                 
                 
                 
          <td><a href="#" target="_top" onclick="MM_nbGroup('down','group1','tools','http://www.rahlentertainment.com/livexchange/forums/images/trapazoid/buttons/tools_down.jpg',1)" onmouseover="MM_nbGroup('over','tools','http://www.rahlentertainment.com/livexchange/forums/images/trapazoid/buttons/tools_over.jpg','http://www.rahlentertainment.com/livexchange/forums/images/trapazoid/buttons/tools_over_down.jpg',1)" onmouseout="MM_nbGroup('out')"><img src="http://www.rahlentertainment.com/livexchange/forums/images/trapazoid/buttons/tools.jpg" alt="Tools" name="tools" width="62" height="24" border="0" id="tools" onload="" /></a></td>
                 
                 
                 
          <td><a href="#" target="_top" onclick="MM_nbGroup('down','group1','database','http://www.rahlentertainment.com/livexchange/forums/images/trapazoid/buttons/database_down.jpg',1)" onmouseover="MM_nbGroup('over','database','http://www.rahlentertainment.com/livexchange/forums/images/trapazoid/buttons/database_over.jpg','http://www.rahlentertainment.com/livexchange/forums/images/trapazoid/buttons/database_over_down.jpg',1)" onmouseout="MM_nbGroup('out')"><img src="http://www.rahlentertainment.com/livexchange/forums/images/trapazoid/buttons/database.jpg" alt="Database" name="database" width="81" height="24" border="0" id="database" onload="" /></a></td>
                 
                 
                 
          <td><a href="#" target="_top" onclick="MM_nbGroup('down','group1','help','http://www.rahlentertainment.com/livexchange/forums/images/trapazoid/buttons/help_down.jpg',1)" onmouseover="MM_nbGroup('over','help','http://www.rahlentertainment.com/livexchange/forums/images/trapazoid/buttons/help_over.jpg','http://www.rahlentertainment.com/livexchange/forums/images/trapazoid/buttons/help_over_down.jpg',1)" onmouseout="MM_nbGroup('out')"><img src="http://www.rahlentertainment.com/livexchange/forums/images/trapazoid/buttons/help.jpg" alt="Help" name="help" width="56" height="24" border="0" id="help" onload="" /></a></td>
                 
                  <td><img src="http://www.rahlentertainment.com/livexchange/forums/images/trapazoid/main_navbar_right_end.jpg" /></td>
                 
                 
    </tr>
</table>

</body>
</html>


If I paste the HTML code directly into the template, I get the same result. The code works fine though in a dreamweaver preview.


Since my forum technically isn't open yet, I'll leave this live, so you can see what it's doing.

If anyone has any sugguestions on what to try, it would be greatly appreciated.

thanks,

Nick


P.S.

If it helps, the following code actually displays on the page:

HTML Code:

0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i 2) { if ((img = MM_findObj(args[2])) != null && !img.MM_init) { img.MM_init = true; img.MM_up = args[3]; img.MM_dn = img.src; if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new Array(); nbArr[nbArr.length] = img; for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) { if (!img.MM_up) img.MM_up = img.src; img.src = img.MM_dn = args[i+1]; nbArr[nbArr.length] = img; } } } else if (event == "over") { document.MM_nbOver = nbArr = new Array(); for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(args[i])) != null) { if (!img.MM_up) img.MM_up = img.src; img.src = (img.MM_dn && args[i+2]) ? args[i+2] : ((args[i+1])? args[i+1] : img.MM_up); nbArr[nbArr.length] = img; } } else if (event == "out" ) { for (i=0; i < document.MM_nbOver.length; i++) { img = document.MM_nbOver[i]; img.src = (img.MM_dn) ? img.MM_dn : img.MM_up; } } else if (event == "down") { nbArr = document[grpName]; if (nbArr) for (i=0; i < nbArr.length; i++) { img=nbArr[i]; img.src = img.MM_up; img.MM_dn = 0; } document[grpName] = nbArr = new Array(); for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) { if (!img.MM_up) img.MM_up = img.src; img.src = img.MM_dn = (args[i+1])? args[i+1] : img.MM_up; nbArr[nbArr.length] = img; } } } //-->

lightnb 06-13-2006 08:15 AM

It's now working correctly, with one exception:

The down images don't stick, they keep resetting when the new page loads


All times are GMT. The time now is 08:19 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.02629 seconds
  • Memory Usage 1,798KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_html_printable
  • (2)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (2)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete