Metachecker.net
|
FontsMadeEasy.com
|
RankChecker.net
Learn Java Script Today
|
Over 5000 Free Fonts
|
Tutorials
|
Javascript Forum
|
Other Javascript Resources
|
Cheat Sheet
JavaScript Basics
Inserting Javascript
Complete Tutorial
Advance DHTML Tutorial
Script archive
Advanced Tutorials
Alert Scripts
Animation
Audio
Background Effects
Banner Ads
Browser Window
Buttons
Button Forms
Calculcators
Calendars
Clocks & Dates
Cookies
Cursor Effects
DHMTL Games
DHTML Miscellaneous
Equivalents
Forms
Games
IE4+ Scripts
IE5+ Scripts
Image Effects
Image Miscellaneous
Links & Buttons
Math Related
Messages Miscellaneous
Miscellaneous
Mouse Tricks
Navigation
Page Details
Password Protection
Pulldown Menus
Random Stuff
Scrolling
Status Bar
Text Animation
User Detail
User Info
Window Control
Moon Phases
Displays the moon's current phase and estimates the time of the next full moon, using a calculation of the moon's rotation and the date.
Insert into <HEAD>
Insert into <BODY>
<SCRIPT LANGUAGE="JavaScript"> <!-- Original: James Thiele (mailto:jet@eskimo.com) --> <!-- Begin // Save the two necessary images from our example page at: // http://messages.javascriptsource.com/moon-phases.html var black = "http://www.your-site.com/images/moon-pics/black.gif"; var white = "http://www.your-site.com/images/moon-pics/white.gif"; var height=1; var size = 50; var i; var currentDate = new Date(); var x = currentDate; currentDate.setTime(currentDate.getTime() + (currentDate.getTimezoneOffset()*60000)); var blueMoonDate = new Date(96, 1, 3, 16, 15, 0); var lunarPeriod = 29*(24*3600*1000) + 12*(3600*1000) + 44.05*(60*1000); var moonPhaseTime = (currentDate.getTime() - blueMoonDate.getTime()) % lunarPeriod; var percentRaw = (moonPhaseTime / lunarPeriod); var percent = Math.round(100*percentRaw) / 100; var percentBy2 = Math.round(200*percentRaw); var left = (percentRaw >= 0.5) ? black : white; var right = (percentRaw >= 0.5) ? white : black; var time = Math.round((lunarPeriod-moonPhaseTime)/(24*3600*1000)); document.write("<center>"); if (percentBy2 > 100) { percentBy2 = percentBy2 - 100; } for (i = -(size-1); i < size; ++i) { var wid=2*parseFloat(Math.sqrt((size*size)-(i*i))); if (percentBy2 != 100) document.write ("<img src="+left +" height=1 width="+(wid*((100-percentBy2)/100))+">"); if (percentBy2 != 0) document.write("<img src="+right+" height=1 width="+(wid*((percentBy2)/100))+">"); document.write("<br>"); } document.write("<BR><FONT SIZE=4>Next full moon is in about ",time," day"); if (time > 1) document.write("s"); document.write("</font>"); // End --> </script>
Other Options