Results 1 to 8 of 8

Thread: {Resolved} DHTML- I'm having problems with script

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2005
    Posts
    8

    {Resolved} DHTML- I'm having problems with script

    http://simplythebest.net/scripts/DHT...script_82.html

    see this script here, now the two images, how do I put it in the script there?
    Can someone fix this code and post the right code here with the image thingy in the right place ? or give me any idea how to do it?
    Last edited by Moonlight Shadow; Jun 6th, 2005 at 01:55 PM.

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: DHTML- I'm having problems with script

    What two images?

  3. #3

    Thread Starter
    New Member
    Join Date
    Apr 2005
    Posts
    8

    Re: DHTML- I'm having problems with script

    the images that're give n in the zip file that's instructed to download right below the script text box

  4. #4
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: DHTML- I'm having problems with script

    If they're in the same folder as your HTML file, simply put white.gif and black.gif. I've highlighted the portion in green below.

    Code:
    <!-- Moon Phase Start -->
    <script language=JavaScript>
    <!--hide
    // Written by James Thiele [email protected] http://www.eskimo.com/~jet/javascript/moonphase
    // Permission granted to SimplytheBest.net to feature script in its DHTML script collection
    // Courtesy of SimplytheBest.net - http://simplythebest.net/scripts/
    function showMoon() {
    var height=1
    var size = 50
    var i
    var currentDate  = new Date()
    // Convert it to GMT
    	currentDate.setTime(currentDate.getTime() + (currentDate.getTimezoneOffset()*60000))
    // Get Date (GMT) for recent full moon
    // NOTE: months, hours, and minutes are 0 based
    var blueMoonDate = new Date(96, 1, 3, 16, 15, 0)
    // Compute length of lunar period -- source: World Almanac
    var lunarPeriod  = 29*(24*3600*1000) + 12*(3600*1000) + 44.05*(60*1000)
    var moonPhaseTime = (currentDate.getTime() - blueMoonDate.getTime()) % lunarPeriod
    // alert("Moon phase in days = "+moonPhaseTime/(24*3600*1000))
    // Compute various percentages of lunar cycle
    var percentRaw = (moonPhaseTime / lunarPeriod)
    	// alert("% = "+percentRaw)
    var percent    = Math.round(100*percentRaw) / 100
    	// alert("% = "+percent)
    var percentBy2 = Math.round(200*percentRaw)
    var left  = (percentRaw >= 0.5) ? "moon_phase/black.gif" : "moon_phase/white.gif"
    var right = (percentRaw >= 0.5) ? "moon_phase/white.gif" : "moon_phase/black.gif"
    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>")
    	} // for
    document.write(	"</center>",
                  "<BR>",
     				"<font size=4 face=Arial>",
     				"Next full moon in about ",
     				Math.round((lunarPeriod-moonPhaseTime)/(24*3600*1000)),
    				" day",
    				Math.round((lunarPeriod-moonPhaseTime)/(24*3600*1000)) != 1 ? "s" : "",
    				"")
    }
    // -->
    </script>
    <script>
    showMoon()
    </script>
    <!-- Moon Phase End -->

  5. #5

    Thread Starter
    New Member
    Join Date
    Apr 2005
    Posts
    8

    Re: DHTML- I'm having problems with script

    ooh ! but I already did that ! i put the images in the same m webs folder where my webfiles are and the same thing that you highlighted was there too but "what changes do I make in them to make the script work"? It just isn't working ! do i change the name of the files and put that changed name in the sript? wud that make any differance ? plz help :'(

  6. #6
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: DHTML- I'm having problems with script

    So you changed those lines to:

    Code:
    var left  = (percentRaw >= 0.5) ? "black.gif" : "white.gif"
    var right = (percentRaw >= 0.5) ? "white.gif" : "black.gif"
    ?

  7. #7

    Thread Starter
    New Member
    Join Date
    Apr 2005
    Posts
    8

    Re: DHTML- I'm having problems with script

    yeah I did ! Thanks so much ! it really helped and now the moon is showing finally ! , what I didi was that I didn't change the moon_ whatever it was in the script before white/black.gif ! that really was the prob there... thanks so much for pointing it out !

  8. #8
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: DHTML- I'm having problems with script

    add [Resolved] to the thread title and do a little dance by yourself.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width