Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

Coding Forum


You are currently viewing our Coding Forum as a guest. Please register to participate.
Login



Reply
Old 08-16-2004, 08:56 PM Javascript Help
KRYPTOR's Avatar
Skilled Talker

Posts: 62
Name: Ray
Location: Illinois
Trades: 0
I have this Fade Javascript that works quite well, but
I need to do 2 things to it.

1) I wish for the background color to appear immediately with
the text. The Background Color ONLY appears with mouseover.
In other words, only the text is there at the start, I want the
BackgroundColor #134c39 to be there with it.

2) How do I increase the SPEED of the FADE process, it's
TOO SLOW for me.

Here's the Fade Script:

<script type = "text/javascript">
var fmTimer = null;
function fminit(){
if (!document.getElementById) return;
fma1=0xFF; fma2=0xFF; fma3=0xFF;
fma4=0x00; fma5=0x00; fma6=0x00;
fmb1=0x13; fmb2=0x4c; fmb3=0x39;
fmb4=0x00; fmb5=0x99; fmb6=0x99;
fmFade();
}
function fmToHex(n){
var hexChars = "0123456789ABCDEF";
if (n == 0) return "00";
var j, n;
var temp = "";
while (n != 0){
j = n % 16;
n = (n - j)/16;
temp = hexChars.charAt(j) + temp;
}
if (temp.length < 2){
temp = "0" + temp;
}
return temp;
}

function fmFade(){
obj = document.getElementById('tekst').style;
fmcolor = "#" + fmToHex(fma1) + fmToHex(fma2) + fmToHex(fma3);
obj.color = fmcolor;
if (fma1 != fma4){
if (fma4 > fma1){fma1++;}
else{fma1--;}}
if (fma2 != fma5){
if (fma5 > fma2){fma2++;}
else{fma2--;}}
if (fma3 != fma6){
if (fma6 > fma3){fma3++;}
else{fma3--;}}
fmbackcolor = "#" + fmToHex(fmb1) + fmToHex(fmb2) + fmToHex(fmb3);
obj.backgroundColor = fmbackcolor;
if (fmb1 != fmb4){
if (fmb4 > fmb1){fmb1++;}
else{fmb1--;}}
if (fmb2 != fmb5){
if (fmb5 > fmb2){fmb2++;}
else{fmb2--;}}
if (fmb3 != fmb6){
if (fmb6 > fmb3){fmb3++;}
else{fmb3--;}}
if ((fma1 == fma4) && (fma2 == fma5) && (fma3 == fma6) && (fmb1 == fmb4) && (fmb2 == fmb5) && (fmb3 == fmb6)){
window.clearTimeout(fmTimer);
}
else{
fmTimer = window.setTimeout("fmFade()",1);
}
}
</script>

<span id="tekst" style="font-size:16; font-family: Arial, Helvetica, sans-serif; letter-spacing:normal; font-weight:bold; font-style:normal; padding-left:14px; padding-right:14px;" onmouseover="fminit()">Mortgage</span>


The KRYPTOR
__________________
"What is SEEN is TEMPORAL, What is UNSEEN is ETERNAL".


Please login or register to view this content. Registration is FREE
KRYPTOR is offline
Reply With Quote
View Public Profile Visit KRYPTOR's homepage!
 
 
Register now for full access!
Reply     « Reply to Javascript Help
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 1.13071 seconds with 12 queries