Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with basic rollover

Status
Not open for further replies.

noobie

Technical User
Mar 25, 2002
6
AU
This is what I have, the images will not load up

<script language=&quot;JavaScript&quot; type=&quot;text/javascript&quot;>
<!-- Hide from older browsers
function SwitchImg()
{ //start
var rem, keep=0, store, obj, switcher=new Array, history=document.Data;
for (rem=0; rem < (SwitchImg.arguments.length-2); rem+=3) {
store = SwitchImg.arguments[(navigator.appName == 'Netscape')?rem:rem+1];
if ((store.indexOf('document.layers[')==0 && document.layers==null) ||
(store.indexOf('document.all[')==0 && document.all==null))
store = 'document'+store.substring(store.lastIndexOf('.'),store.length);
obj = eval(store);
if (obj != null) {
switcher[keep++] = obj;
switcher[keep++] = (history==null || history[keep-1]!=obj)?obj.src:history[keep];
obj.src = SwitchImg.arguments[rem+2];
} }
document.Data = switcher;
} //end

function RestoreImg()
{ //start
if (document.Data != null)
for (var rem=0; rem<(document.Data.length-1); rem+=2)
document.Data[rem].src=document.Data[rem+1];
} //end

// end hiding contents -->

</script>



then on the layer
I have

<div id=&quot;Design&quot; style=&quot;position:absolute; width:126px; height:34px; z-index:7; left: 247px; top: 83px&quot;><a href=&quot;design.html&quot; onMouseOut=&quot;RestoreImg()&quot; onMouseOver=&quot;SwitchImg('document.Design','document.Design','../images/designlinkover.gif')&quot;><img src=&quot;../images/designlink.gif&quot; name=&quot;Design&quot; width=&quot;0&quot; height=&quot;0&quot; border=&quot;0&quot;></a></div>

It's just there is absolutely nothing when there when the page loads up. And yes, the image links do work by themselves, meaning they are the right links..
 
hie

wooo.. so *advanced* script..
you could do that much easyer, but here are something i saw:

1. both image & division have the same name/id - they shouldn't
2. document.Data should be global (i guess it is)
3. afaik, document.imagename won't give you the reference to the image in the ~75% of cases

anyone else?
Victor
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top