Jump to content

Hover-over Buttons Not Working...


RawDog

Recommended Posts

Well, I'd like to say thanks to those for helping me out in the PHP section. Much appreciated. :) But now, I seem to be having problems with the Javascript.

// JavaScript Documentvar images_dir = 'images/';var over_prepend = '_over.gif';var img_prepend = '_img';function add_handlers() {	var i, args,d, link, img, id, to_preload, function_string;	d = document;	args = add_handlers.arguments;	to_preload = '';	function_string = '';	if(d.images) {		for(i = 0; i <args.length; i++) {			id = args[i];			elem = d.getElementById(id)			eval("elem.onmouseover = function() { MM_swapImage(\'"+id+img_prepend+"\',\'\',\'"+images_dir+id+over_prepend+"\',1); } ");			d.getElementById(id).onmouseout = function() { MM_swapImgRestore(); }; 			to_preload += "'"+images_dir+id+over_prepend+"',";		}	}	to_preload = to_preload.substr(0,(to_preload.length-1));	exec("MM_preloadImages("+to_preload+");");}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_swapImgRestore() { //v3.0  var i,x,a=document.MM_sr;for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;}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_swapImage() { //v3.0  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} }

This is my code for the hover-over buttons. And here is the HTML that I have located inside my website with the buttons...

<div id="navbar" class="navbg">		<a href="#" id="nav_home"><img src="../images/nav_home.gif" id="nav_home_img" alt="" /></a><a href="#" id="nav_news"><img src="../images/nav_news.gif" id="nav_news_img" alt="" /></a><a href="#" id="nav_reviews"><img src="../images/nav_reviews.gif" id="nav_reviews_img" alt="" /></a><a href="#" id="nav_videos"><img src="../images/nav_videos.gif" id="nav_videos_img" alt="" /></a><a href="http://ultimaterockstar.ipbfree.com" id="nav_forums"><img src="../images/nav_forums.gif" id="nav_forums_img" alt="" /></a>	</div>

Now, it works perfectly on the homepage, but now that I added a /tab folder in my hosting account, it won't work. Here is the on load code within the <body> tags:

<script type="text/javascript" src="../common.js"></script></head><body onload="add_handlers('nav_home','nav_news','nav_reviews','nav_videos','nav_forums');">

(I included the external JS file and the onload as well. Help is deeply appreciated! :)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...