PDA

View Full Version : how can i use rollover images on this menu?



korndogg27
06-11-2007, 05:43 PM
http://www.dynamicdrive.com/dynamicindex1/tabmouseover.htm

i really like the menu, the thing is i have no clue to with how to alter the top text into images... and images that change when you hover the mouse pointer on it.

here's an example: www.bengals.com

see how the top nav where 'team' 'news' 'tckets', etc are? i want that image changing effect. i already am creating the images. my biggest challenge now is to get that effect to work with this tab mouse over menu.

somebody pleeeeease help me with this.!!!!!!!

i have even included the code to make it easier for you guys to understand what im trying to do. i have 2 onMouseover events on one because i need it to do both. but it only choses one or the either. more specifically the first of whatever onMouseover command.

--start sample code--
<!--Links used to initiate the sub menus. Pass in the desired submenu index numbers (ie: 0, 1) -->
<table border="1" width="35&#37;" id="table1">
<tr>
<td width="140">
<a href="http://www.northwestjaguars.com/team.html" onMouseover="showit(0)" onMouseOut="if(document.images){document.abc.src='http://www.northwestjaguars.com/files/TopNavigation/06Basic-A.gif';}" target="_self" onMouseOver="if(document.images){document.abc.src='http://www.northwestjaguars.com/files/TopNavigation/06Basic-B.gif';}">
<img alt="" name="abc" src="http://www.northwestjaguars.com/files/TopNavigation/06Basic-A.gif" height="49" border="0" width="117"></a></td>
<td>
<a href="http://www.northwestjaguars.com/news.html" onMouseover="showit(1)">News</a></td>
</tr>
</table>
<div id="describe" style="background-color:#CCCCCC;width:383px;height:18px" onMouseover="clear_delayhide()" onMouseout="resetit(event)">
<p align="center"></div>

<script language="JavaScript1.2">

/*
Tabs Menu (mouseover)- By Dynamic Drive
For full source code and more DHTML scripts, visit http://www.dynamicdrive.com
This credit MUST stay intact for use
*/

var submenu=new Array()

//Set submenu contents. Expand as needed. For each content, make sure everything exists on ONE LINE. Otherwise, there will be JS errors.

submenu[0]='<font size="2" face="Verdana"><b><a href="http://www.northwestjaguars.com/team.html">Roster</a> | <a href="http://www.northwestjaguars.com/coaches.html">Coaching Staff</a> | <a href="http://www.northwestjaguars.com/juniorvarsity.html">Junior Varsity</a> | <a href="http://www.northwestjaguars.com/stats.html">Stats</a></b></font>'
submenu[1]='<font size="2" face="Verdana"><b><a href="http://www.northwestjaguars.com/news.html">Latest News</a> | <a href="http://www.northwestjaguars.com/archives.html">Archives</a></b></font>'

//Set delay before submenu disappears after mouse moves out of it (in milliseconds)
var delay_hide=500

/////No need to edit beyond here

var menuobj=document.getElementById? document.getElementById("describe") : document.all? document.all.describe : document.layers? document.dep1.document.dep2 : ""

function showit(which){
clear_delayhide()
thecontent=(which==-1)? "" : submenu[which]
if (document.getElementById||document.all)
menuobj.innerHTML=thecontent
else if (document.layers){
menuobj.document.write(thecontent)
menuobj.document.close()
}
}

function resetit(e){
if (document.all&&!menuobj.contains(e.toElement))
delayhide=setTimeout("showit(-1)",delay_hide)
else if (document.getElementById&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
delayhide=setTimeout("showit(-1)",delay_hide)
}

function clear_delayhide(){
if (window.delayhide)
clearTimeout(delayhide)
}

function contains_ns6(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

</script>
--end sample code--

korndogg27
06-11-2007, 08:55 PM
actually i figured that out myself. (placed a semicolon). now my problem is.. when i scroll down to the selections, the image goes back to its original form.