PDA

View Full Version : Java script navbar doesn't work, and causes entire site to 'freak out'


lightnb
06-07-2006, 12:44 AM
In my 'mast_head' template, after the main forum graphics, I have:

$main_navbar

Which is attached to a plugin, hooked at global_start, and contains the 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:


<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:

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, 09:15 AM
It's now working correctly, with one exception:

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