JavaScript Source Code 3000: Messages: Moon Phases
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.
You must also save these images
to your server to use this script.
Right-click the images below and
select "Save Image As..."
JavaScript Source Code 3000: Messages: Moon Phases
Simply click inside the window below, use your cursor to highlight the script, and copy (type Control-c or Apple-c) the script into a new file in your text editor (such as Note Pad or Simple Text) and save (Control-s or Apple-s). The script is yours!!!
<!-- ONE STEP TO INSTALL MOON PHASES:
1. Copy the coding into the BODY of your HTML document -->
<!-- STEP ONE: Paste this code into the BODY of your HTML document -->
<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-web-site-address-here.com/images/moon-pics/black.gif";
var white = "http://www.your-web-site-address-here.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("");
// End -->
</script>
<!-- Script Size: 1.83 KB -->
Wyszukiwarka
Podobne podstrony:
Twilight Saga New Moon 2009 CAM XviD POISONSailor Moon SuperS ep 139Sailor Moon SuperS ep 135Moon Over ManifestSailor Moon SuperS ep 129Sailor Moon SuperS ep 144Sailor Moon SuperS ep 128UFO Unclassified Documents (EN) Moon Dust ReportingTwilight New Moon TELESYNC newSailor Moon SuperS ep 156acircuit phasesplitSailor Moon SuperS ep 151Saga Zmierzch Księżyc w nowiu New Moon DVDRip XviD NeDiVx rmvbSaga Zmierzch Księżyc w nowiu Twilight New Moon 2009Sailor Moon SuperS ep 153Sailor Moon SuperS ep 164aplan phases and iterations*B1A5C9Sailor Moon SuperS ep 162więcej podobnych podstron