...

View Full Version : how to make cool link



jshl_wiz
05-23-2005, 04:01 AM
ok i can't believe i forgot how to do this :mad:
this JS code is supposed to make a link change its background color when you put the mouse over it, the background has to become clearer and clearer as 600 miliseconds pass.... hope you understood MY INGLES NO GOOD :D .
I keep on getting the error "object required" would anyone please help??

Here's the code:

<html>
<head><title>Sistema de Navegación 1</title>
<script language="JavaScript">
<!--

function fadeColor(which){
var thecolors = new Array("#C1DAFF","#77ADFF","#3787FF","#004EC1","#0062F4","#0047B3");
thenumber = -1;
if(thenumber<5){
thenumber += 1;
document.anchors(which).style.backgroundColor = thecolors[thenumber];
}
else{}
setTimeout('fadeColor('+which+')', 100);
}
//-->
</script>
</head>
<body>
<a href="sistema_navegacion1.html" style="font-family:arial;text-decoration: none;color:black;" name="ellink" onmouseover="fadeColor('ellink')">Link</a>
</body>
</html>

Single Paradox
05-23-2005, 06:08 AM
Do you mean like the effects on this (http://www.ozzu.com/) page?

If so I can find the javascript for you.

Oh and welcome to coding forums.

Single Paradox
05-23-2005, 06:13 AM
Oh... try replacing the SetTimeout you have with:

setTimeout(function() {fadeColor(which)}, 100);

jshl_wiz
05-23-2005, 05:03 PM
ummm, it didn't show the error message after i changed the "setTimeOut" part, but it still didn't do what I wanted it to do. See, I wanted it to make the background Color darker and darker every 100 MS. But it just changes the color one time and that's it. Suggestions? :confused:

The link is supposed to first go through #C1DAFF, then after 100 miliseconds it turns into #77ADFF which is the same color in a darker version, then #3787FF which is even darker, and so on until it gets to the darkest color.

Thanks for the help and thanks for welcoming me :thumbsup:

jshl_wiz
05-24-2005, 10:45 PM
Anybody out there that can help me with this? :confused:

Brandoe85
05-24-2005, 11:23 PM
<html>
<head><title>Sistema de Navegación 1</title>
<script language="JavaScript">
<!--
var thenumber = 0;
function fadeColor(which)
{
var thecolors = new Array("#C1DAFF","#77ADFF","#3787FF","#004EC1","#0062F4","#0047B3");
if(thenumber<5)
{
document.anchors[which].style.backgroundColor = thecolors[thenumber];
thenumber++;
}
setTimeout(function() {fadeColor(which)}, 100);
}

//-->
</script>
</head>
<body>
<a href="sistema_navegacion1.html" style="font-family:arial;text-decoration: none;color:black;" name="ellink" onmouseover="fadeColor('ellink')">Link</a>
</body>
</html>

jshl_wiz
05-25-2005, 06:22 PM
thanks brando, even though i had to change the document.anchors[] for document.anchors(), but that solved my problem, really appreciate it :thumbsup:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum