MajorGeeks Support Forums

Go Back   MajorGeeks Support Forums > ----------= PC, Desktop and Laptop Support =---------- > Software
Register FAQ Members List Calendar Casino Mark Forums Read

Software Software such as operating systems like Windows XP, Windows Vista, Windows 7 etc., or specific programs.


Reply
 
Thread Tools Display Modes
  #1  
Old 10-26-03, 11:53
mr_flea mr_flea is offline
Sergeant Major
 
Join Date: Sep 2003
Posts: 750
Thanks: 0
Thanked 0 Times in 0 Posts
Default Javascript Background

I want to add a background picture to my webpage after the javascript code finishes, but I have to put it in the javascript, not html, or it won't show up. My question is, how do I add a background picture after the page dims from orange to dark blue?

Here's the code:
<script language="javascript">
<!--
function makearray(n)
{
this.length = n;
for(var i = 1; i <= n; i++) this[i] = 0;
return this;
}

hexArray = new makearray(16);


for(var i = 0; i < 10; i++) hexArray[i] = i;
hexArray[10]="A"; hexArray[11]="B"; hexArray[12]="C";
hexArray[13]="D"; hexArray[14]="E"; hexArray[15]="F";

function makeHex(i)
{
if (i < 0) return "00";

else if (i > 255) return "FF";

else
return "" + hexArray[Math.floor(i/16)] + hexArray[i%16];
}


function setbgColor(r, g, b)
{
var red = makeHex(r); var green = makeHex(g); var blue = makeHex(b);
document.bgColor = "#"+red+green+blue;
}


function fade(sr, sg, sb, er, eg, eb, inc)
{
// keep updating the background color
for(var i = 0; i <= inc; i++)
{
setbgColor(
Math.floor(sr * ((inc-i)/inc) + er * (i/inc)),
Math.floor(sg * ((inc-i)/inc) + eg * (i/inc)),
Math.floor(sb * ((inc-i)/inc) + eb * (i/inc)));
}
}



// (RGB Color Values)
fade(255,102,0, 0,0,51, 1000);


// -->
</script>

Last edited by mr_flea; 10-26-03 at 14:25..
Reply With Quote
Sponsored links
  #2  
Old 10-26-03, 14:33
mr_flea mr_flea is offline
Sergeant Major
 
Join Date: Sep 2003
Posts: 750
Thanks: 0
Thanked 0 Times in 0 Posts
Default

what would be even nicer is if i could fade it from orange to dark blue (it already does that), and then fade into the picture. Either way would work. Any ideas?
Reply With Quote
Reply

Thread Tools
Display Modes

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

Forum Jump


All times are GMT -5. The time now is 04:15.

MajorGeeks.Com Menu

MajorGeeks.Com \ All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ NEW! PC Games \ System Tools \ Macintosh \ Demonews.Com \ Top Downloads

MajorGeeks.Com \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds


Powered by vBulletin® Version 3.8.4
Copyright © 2009 vBulletin Solutions, Inc. All rights reserved.
Ad Management by RedTyger