IMPORTANT! The server may go down soon - possibly permanently. Please read the latest post in Announcements and News

I strongly advise all users using my server for their web site to make alternative arrangements.

Outgoing mail is disabled because of the malware on the server. No new forum registrations are currently possible, and mail to the forum administrator will not work.

Please read the posts in the Announcements section about the current status of Cumulus development now that I have retired

Please read this post before posting

Latest Cumulus release v1.9.4 (build 1099) - Nov 28 2014
Latest Cumulus MX release - v3.0.0 build 3043 Jan 20 2017. See this post for download

Moon Ditty

Other discussion about creating web sites for Cumulus that doesn't have a specific subforum

Moderators: daj, TNETWeather

Warrandyte
Posts: 41
Joined: Sat Apr 06, 2013 11:46 pm
Weather Station: Fine Offset with Solar
Operating System: Windows XP, 7 8 and 10
Location: TIrrannaville NSW Australia

Moon Ditty

Postby Warrandyte » Wed Jun 07, 2017 5:41 am

Just a quick little something to replace the moon image
it uses the MoonPercent Webtag and gets an appropriate image for that phase of the moon
like so:
Image
theres a bit of code to go in the placeholder for the image, and the moon images need to be in the images/moon/directory relative to the page.
I've kept the code verbose so people can see and change
hope someone finds it useful.
Theres also a large script animated moon at http://www.warrandytefarm.com/moon_large.htm
all the files are in Image
http://www.warrandytefarm.com/resources/moon.zip
Rob

Code: Select all

<script type="text/javascript">
var MoonPC=-<#MoonPercent>/100;
var ImageNum=0;
ImageNum=Math.round((1+MoonPC)*12);
if(ImageNum<10){
ImageNum=String(0)+String(ImageNum);
}
document.write("<img src=\"images/moon/moon_"+ImageNum+".png\"width=\"150px\" height=\"150px\"/>");
</script>

Return to “Web site - General”

Who is online

Users browsing this forum: No registered users and 4 guests