Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Design and Graphics Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 02-11-2007, 10:18 AM
Bratz-Designs Bratz-Designs is offline
 
Join Date: Jul 2005
Location: Netherlands
Posts: 236
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default rollover buttons

Hey all,

I have been trying to code some rollover buttons on my forum but something seems to go wrong, can you help me figure out what exactly?

In headeInclude:
Code:
<script type="text/javascript"> 
<!-- 

if (document.images) 
    { 
	image1on = new Image(); 
	image1on.src = "http://www.bratz-designs.com/forums/images/afterdark/misc/home.gif"; 
	image1off = new Image(); 
	image1off.src = "http://www.bratz-designs.com/forums/images/afterdark/misc/home_over.gif";  
	image2on = new Image(); 
	image2on.src = "http://www.bratz-designs.com/forums/images/afterdark/misc/forum.gif"; 
	image2off = new Image(); 
	image2off.src = "http://www.bratz-designs.com/forums/images/afterdark/misc/forum_over.gif"; 
	image3on = new Image(); 
	image3on.src = "http://www.bratz-designs.com/forums/images/afterdark/misc/usercp.gif"; 
	image3off = new Image(); 
	image3off.src = "http://www.bratz-designs.com/forums/images/afterdark/misc/usercp_over.gif"; 
	image4on = new Image(); 
	image4on.src = "http://www.bratz-designs.com/forums/images/afterdark/misc/arcade.gif"; 
	image4off = new Image(); 
	image4off.src = "http://www.bratz-designs.com/forums/images/afterdark/misc/arcade_over.gif"; 
	image5on = new Image(); 
	image5on.src = "http://www.bratz-designs.com/forums/images/afterdark/misc/chat.gif"; 
	image5off = new Image(); 
	image5off.src = "http://www.bratz-designs.com/forums/images/afterdark/misc/chat_over.gif"; 
	image6on = new Image(); 
	image6on.src = "http://www.bratz-designs.com/forums/images/afterdark/misc/members.gif"; 
	image6off = new Image(); 
	image6off.src = "http://www.bratz-designs.com/forums/images/afterdark/misc/members_over.gif";
	image7on = new Image(); 
	image7on.src = "http://www.bratz-designs.com/forums/images/afterdark/misc/faq.gif"; 
	image7off = new Image(); 
	image7off.src = "http://www.bratz-designs.com/forums/images/afterdark/misc/faq_over.gif";
	image8on = new Image(); 
	image8on.src = "http://www.bratz-designs.com/forums/images/afterdark/misc/affiliates.gif"; 
	image8off = new Image(); 
	image8off.src = "http://www.bratz-designs.com/forums/images/afterdark/misc/affiliates_over.gif";
	image9on = new Image(); 
	image9on.src = "http://www.bratz-designs.com/forums/images/afterdark/misc/topsites.gif"; 
	image9off = new Image(); 
	image9off.src = "http://www.bratz-designs.com/forums/images/afterdark/misc/topsites_over.gif";  
	image10on = new Image(); 
	image10on.src = "http://www.bratz-designs.com/forums/images/afterdark/misc/logout.gif"; 
	image10off = new Image(); 
	image10off.src = "http://www.bratz-designs.com/forums/images/afterdark/misc/logout_over.gif";
    }  

function changeImages() 
    { 
	if (document.images) 
	    { 
for (var i=0; i<changeImages.arguments.length; i+=2) 
    { 
	document[changeImages.arguments[i]].src = eval(changeImages.arguments[i+1] + ".src"); 
    } 
	    } 
    } 

// --> 
</script>
In header template:
Code:
   <td width="100%" height="33" align="left" valign="top" style="background-image:url($stylevar[imgdir_misc]/xnav.gif)"><table width="100%"  border="0" cellpadding="0" cellspacing="0">
        <tr>
<td align="left" valign="top" width="79" height="33"><a href="http://www.bratz-designs.com" onmouseover="changeImages('image1', 'image1off')" onmouseout="changeImages('image1', 'image1on')><img src="http://www.bratz-designs.com/forums/images/afterdark/misc/home.gif" width="79" height="33" name="image1"  border="0" alt="Home" 'image1on'/></a></td>
<td align="left" valign="top" width="79" height="33"><a href="http://www.bratz-designs.com/forums/index.php" onmouseover="changeImages('image2', 'image2off')" onmouseout="changeImages('image2', 'image2on')><img src="http://www.bratz-designs.com/forums/images/afterdark/misc/forum.gif" width="79" height="33" name="image2"  border="0" alt="Forum" 'image2on'/></a></td>
<td align="left" valign="top" width="79" height="33"><a href="http://www.bratz-designs.com/forums/usercp.php$session[sessionurl_q]" onmouseover="changeImages('image3', 'image3off')" onmouseout="changeImages('image3', 'image3on')><img src="http://www.bratz-designs.com/forums/images/afterdark/misc/usercp.gif" width="79" height="33" name="image3" border="0" alt="UserCp" 'image3on'/></a></td>
<td align="left" valign="top" width="79" height="33"><a href="http://www.bratz-designs.com/forums/arcade.php$session[sessionurl_q]" onmouseover="changeImages('image4', 'image4off')" onmouseout="changeImages('image4', 'image4on')><img src="http://www.bratz-designs.com/forums/images/afterdark/misc/arcade.gif" width="79" height="33" name="image4" border="0" alt="Arcade" 'image4on'/></a></td>
<td align="left" valign="top" width="79" height="33"><a href="http://www.bratz-designs.com/forums/javachat.php$session[sessionurl_q]" onmouseover="changeImages('image5', 'image5off')" onmouseout="changeImages('image5', 'image5on')><img src="http://www.bratz-designs.com/forums/images/afterdark/misc/chat.gif" width="79" height="33" name="image5" border="0" alt="Chat" 'image5on'/></a></td>
<td align="left" valign="top" width="79" height="33"><a href="http://www.bratz-designs.com/forums/memberlist.php$session[sessionurl_q]" onmouseover="changeImages('image6', 'image6off')" onmouseout="changeImages('image6', 'image6on')><img src="http://www.bratz-designs.com/forums/images/afterdark/misc/members.gif" width="79" height="33" name="image6" border="0" alt="Members" 'image6on'/></a></td>
<td align="left" valign="top" width="79" height="33"><a href="http://www.bratz-designs.com/forums/affiliates.php$session[sessionurl_q]" onmouseover="changeImages('image8', 'image8off')" onmouseout="changeImages('image8', 'image8on')><img src="http://www.bratz-designs.com/forums/images/afterdark/misc/affiliates.gif" width="79" height="33" name="image8" border="0" alt="Affiliates" 'image8on'/></a></td>
<td align="left" valign="top" width="79" height="33"><a href="http://www.bratz-designs.com/forums/toplist.php$session[sessionurl_q]" onmouseover="changeImages('image9', 'image9off')" onmouseout="changeImages('image9', 'image9on')><img src="http://www.bratz-designs.com/forums/images/afterdark/misc/topsites.gif" width="79" height="33" name="image9" border="0" alt="Toplist" 'image9on'/></a></td>
<td align="left" valign="top" width="79" height="33"><a href="http://www.bratz-designs.com/forums/faq.php$session[sessionurl_q]" onmouseover="changeImages('image7', 'image7off')" onmouseout="changeImages('image7', 'image7on')><img src="http://www.bratz-designs.com/forums/images/afterdark/misc/faq.gif width="79" height="33" name="image7" border="0" alt="" 'image7on'"/></a></td>
<if condition="$show['member']">
<td align="left" valign="top" width="79" height="33"><a href="http://www.bratz-designs.com/forums/login.php?$session[sessionurl]do=logout&amp;logouthash=$bbuserinfo[logouthash]" onclick="return log_out() onmouseover="changeImages('image10', 'image10off')" onmouseout="changeImages('image10', 'image10on')"><img src="http://www.bratz-designs.com/forums/images/afterdark/misc/logout.gif" width="79" height="33" name="image10" border="0" alt="" 'image10on'/></a></td>
		</if>
Reply With Quote
  #2  
Old 02-11-2007, 10:40 AM
WEBDosser's Avatar
WEBDosser WEBDosser is offline
 
Join Date: Oct 2001
Location: @ MyPC
Posts: 824
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Rollovers work like this..

Code:
<script type="text/JavaScript">
<!--
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_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_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];}
}
//-->
</script>
<body onLoad="MM_preloadImages('http://www.bratz-designs.com/forums/images/afterdark/misc/logout_over.gif')"><a href="http://gohere" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image1','','http://www.bratz-designs.com/forums/images/afterdark/misc/logout_over.gif',1)"><img src="http://www.bratz-designs.com/forums/images/afterdark/misc/logout.gif" name="Image1" width="80" height="33" border="0"></a>
maybe you could modify that code to work on your header template
Reply With Quote
  #3  
Old 02-12-2007, 06:28 PM
Xplorer4x4 Xplorer4x4 is offline
 
Join Date: Apr 2005
Posts: 938
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

http://chrispoole.com/scripts/javasc...mage-rollover/

This works great for me in the past. Up the js file(possibly to your clientscript directory). Then add
PHP Code:
<script type="text/javascript" src="dom_image_rollover_hover.js"></script
to the headinclude. It may also work by just using it in the header template itself. Been awhile since i used it but if you need help drop me a pm.
Reply With Quote
  #4  
Old 02-14-2007, 04:56 AM
Aken's Avatar
Aken Aken is offline
 
Join Date: Jul 2004
Location: Wisconsin, USA
Posts: 129
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Wouldn't CSS be an easier and less resource-consuming alternative? Seems like a LOT of code just for rollover images.
Reply With Quote
  #5  
Old 03-15-2007, 09:13 PM
Xplorer4x4 Xplorer4x4 is offline
 
Join Date: Apr 2005
Posts: 938
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Try this instead. It is an old vB 2 hack but works great to this day.
Attached Files
File Type: txt [tm] - vbrollovers.txt (3.1 KB, 68 views)
Reply With Quote
  #6  
Old 03-15-2007, 11:34 PM
bigdog829 bigdog829 is offline
 
Join Date: Apr 2005
Location: Michigan
Posts: 113
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Xplorer4x4 View Post
Try this instead. It is an old vB 2 hack but works great to this day.
Thanks alot worked like a charm :up:

EDIT: Only works on vbadvanced homepage ............ any ideas ?

EDIT AGAIN: Added code to the bottom of forumhome is now working there also.
Reply With Quote
  #7  
Old 07-19-2007, 10:39 PM
majorj0nny majorj0nny is offline
 
Join Date: May 2005
Posts: 105
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Xplorer4x4 View Post
Try this instead. It is an old vB 2 hack but works great to this day.
thats a great hack and works well for anything with 'img src' infront of it ... but I use some paypal buttons that start with

Quote:
<input type="image" src="image location" border="0" name="submit" alt="PLEASE HELP - Donate to our Ranked Server Fund!">
and adding the necessary line to that does not work - anyone know how I edit the stuff in the header include to include these 'form' buttons as images?

ta

anyone ???
Reply With Quote
  #8  
Old 08-08-2007, 08:38 PM
majorj0nny majorj0nny is offline
 
Join Date: May 2005
Posts: 105
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

gee thanks...
Reply With Quote
  #9  
Old 08-09-2007, 07:28 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

As Aken has stated, why not use CSS to manage these things, the images can automatically preload as well.
Reply With Quote
  #10  
Old 08-08-2008, 04:11 AM
CLF's Avatar
CLF CLF is offline
 
Join Date: Jun 2007
Posts: 112
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you X!
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:18 AM.


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.04147 seconds
  • Memory Usage 2,292KB
  • Queries Executed 12 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (3)bbcode_code
  • (1)bbcode_php
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (1)postbit_attachment
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • postbit_attachment
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete