| Welcome to Java Land! I will be adding a large amount of Java scripts and HTML cheats, a new one every week! Let me know if there are any you would like that you missed... Email me right here! If you would like to learn more, please visit my Master Site by clicking here. |
| This week - background color change upon web page entry. (Hit refresh to watch the color changes again! :~) (To get this script, right click, copy, and paste just after your first </head>) <script language="JavaScript"><!-- /* _____________________________________________________ | Please don't remove this comment lines | |�����������������������������������������������������| | Background fading using multiple colors | | Created By: Christian Carlessi Salvad� | | E-Mail: [email protected] | |Internet: http://www.geocities.com/Paris/Jardin/8415/| |_____________________________________________________| */ function initArray() { this.length = initArray.arguments.length for (var i = 0; i < this.length; i++) this[i+1] = initArray.arguments[i] } var hexChars = "0123456789ABCDEF"; function Dec2Hex (Dec) { var a = Dec % 16; var b = (Dec - a)/16; hex = "" + hexChars.charAt(b) + hexChars.charAt(a); return hex; } function bgChanger (begin, end, steps) { steps = steps -1 ; redA = begin.charAt(0) + begin.charAt(1); red_valA = parseInt(redA,'16'); redB = end.charAt(0) + end.charAt(1); red_valB = parseInt(redB,'16'); red_int = ((red_valB - red_valA) / steps) * -1; grnA = begin.charAt(2) + begin.charAt(3); grn_valA = parseInt(grnA,'16'); grnB = end.charAt(2) + end.charAt(3); grn_valB = parseInt(grnB,'16'); grn_int = ((grn_valB - grn_valA) / steps) * -1; bluA = begin.charAt(4) + begin.charAt(5); blu_valA = parseInt(bluA,'16'); bluB = end.charAt(4) + end.charAt(5); blu_valB = parseInt(bluB,'16'); blu_int = ((blu_valB - blu_valA) / steps) * -1; step = 2; red = red_valA; grn = grn_valA; blu = blu_valA; document.bgColor = begin; while ( steps >= step ) { red -= red_int; red_round = Math.round(red); red_hex = Dec2Hex(red); grn -= grn_int; grn_round = Math.round(grn); grn_hex = Dec2Hex(grn); blu -= blu_int; blu_round = Math.round(blu); blu_hex = Dec2Hex(blu); document.bgColor = red_hex + grn_hex + blu_hex; step++; } document.bgColor = end; } bgChanger("000000","000000",25); bgChanger("000000","FF0000",25); bgChanger("FF0000","000000",25); bgChanger("000000","AA00EE",25); bgChanger("AA00EE","000000",25); bgChanger("000000","0000FF",25); bgChanger("0000FF","000000",25); bgChanger("000000","FFFFFF",25); // --></script> |
| This script prompts for name upon entry and greets according to time. I got tired of answering it, so here ya go! <SCRIPT language="JavaScript"> <!-- var name = prompt('What is your name?','[]D [] []v[] []D'); var today = new Date(); var hrs = today.getHours(); if (hrs < 5) alert('Good Morning, '+name+', it sure is early !'); else if (hrs < 12) alert('Good Morning, '+name+' '); else if (hrs <= 18) alert('Good Afternoon, '+name+' '); else if (hrs < 24) alert('Good Evening, '+name+' '); //--> </SCRIPT> |
National NetworksSelect a television station from the list to go to it's site Download the Script |