/    Sign up×
Community /Pin to ProfileBookmark

Ok guys I am kind of puzzled on this one I have this script that “FADES IN” text on a white background to black text. But the only thing is I would like to fade in white text from a black background. Right now the script “FADES OUT” white text from a black backgroud?
I think maybe the style.color=”rgb part of the script has to be changed but to what?

Thanks

<html>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″>
<title>Untitled Document</title>
<script language=”javascript”>
col=255;
function fade() { document.getElementById(“fade”).style.color=”rgb(” + col + “,” + col + “,” + col + “)”; col-=5; if(col>0) setTimeout(‘fade()’, 10); }
</script>
<style type=”text/css”>
<!–
body {
background-color: #000000;
}
–>
</style></head>
</head>
<body onload=”fade();”>

<p>
<span id=”fade”>This text will fade in.</span> But this text won’t.
</p>

</body>
</html>

to post a comment
JavaScript

7 Comments(s)

Copy linkTweet thisAlerts:
@javaNoobieNov 01.2004 — change
<i>
</i>&lt;script type="text/JavaScript"&gt;
&lt;!--
[color=red]col=0;[/color]

function fade(){
document.getElementById("fade").style.color="rgb(" + col + "," + col + "," + col + ")";
[color=red]col+=5;[/color]
if([color=red]col&lt;255[/color]){
setTimeout('fade()', 10);
}
}
//--&gt;
&lt;/script&gt;
Copy linkTweet thisAlerts:
@mikemayauthorNov 01.2004 — Cool thanks agan javaNoobie you should change your Nick to JavaNotSoNoobie :p

lol
Copy linkTweet thisAlerts:
@javaNoobieNov 01.2004 — Java and Javascript are different. So I can't change my nick ?
Copy linkTweet thisAlerts:
@mikemayauthorNov 01.2004 — oh ya good point
Copy linkTweet thisAlerts:
@mikemayauthorNov 01.2004 — Is it possible to run this script in to different place on the page like to different <p> tags if so how would I do that?

Thanks

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"

"http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<title>Untitled Document</title>

<script type="text/JavaScript">

<!--

col=0;

function fade(){

document.getElementById("fade").style.color="rgb(" + col + "," + col + "," + col + ")";

col+=5;

if(col<255){

setTimeout('fade()', 10);

}

}

//-->

</script>

<style type="text/css">

<!--

body {

background-color: #000000;

}

-->

</style></head>

</head>

<body onload="fade();">


<p>

<span id="fade">This text will fade in.</span> But this text won't.

<span id="fade">This text will fade in.</span> But this text won't.

</p>


</body>

</html>
Copy linkTweet thisAlerts:
@EntertainerNov 01.2004 — Is it possible to fade in an image?

i tried but it just well doesn't do anything at all.....
×

Success!

Help @mikemay spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.8,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...