PDA

View Full Version : How do you create a rollover link?



faerie_girl
23-02-2005, 04:37 PM
you know the sort i mean...
put ur cursor over the image link and it changes?

any help will be grateful

faerie

lMattz
23-02-2005, 04:48 PM
I think this is it but if it doesn't work just send me a message and ill try to sort it out.

SCRIPT LANGUAGE="JAVASCRIPT">
<!--

function roll(img_name, img_src)
{
document[img_name].src = img_src;
}

//-->
</SCRIPT>

Change the img_src's with the link to the images and the image name to the name u have called it e.g bottle.jpg.

There Ya Go

Matt (Mattz.net)

-JT-
23-02-2005, 05:13 PM
hered da right script :P


none[/COLOR]
}
A:visited {
COLOR: white; TEXT-DECORATION: none
}
A:active {
COLOR: white; TEXT-DECORATION: none
}
A:hover {
COLOR: #0000FF; TEXT-DECORATION: none
</style>

you can change the bits in red to the following:

Under line (underlines)
Score Out(Scores it out, i think :s)
none (just changes the colour)

MAKE SURE THIS GOES IN THE <HEAD> SECTION!! lol. If you are using dreamweaver however, go to insert>interactive images>Flash text

I hope this helps. If you need furtjar assistance, just ask :)

Mentor
23-02-2005, 05:59 PM
or if you ment roll over images (wich can be used as links)

Jam this in the head


<script language="JavaScript" 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>


Then add this attribute the the body tag so its

onload="MM_preloadImages(' Image That rolls over to ')"

<body onload="MM_preloadImages(' Image That rolls over to ')">

Then just use this code where you wnat the roll over image / link

<a href=" URL TO GO TO (link loction ) " onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('mr_Image','',' Image That rolls over to ',1)"><img src=" Normal Image " " name="mr_Image" border="0" id="mr_Image" /></a>

the bold bits need to be edited to your images



(i was boared)

-JT-
23-02-2005, 09:50 PM
well done mentor, lol. Is the score out right?

Want to hide these adverts? Register an account for free!