Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9
  1. #1
    New to the CF scene
    Join Date
    Mar 2009
    Location
    Los Angeles, CA
    Posts
    4
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Smile Help.. Countdown code don't work in Firefox

    Hi, can anyone help with my countdown script, it works on IE but do not
    work on Firefox. I tried this method here still not working http://www.codingforums.com/archive/...p/t-69468.html

    Thanks,
    Eugene

    this is my script
    -------------------
    Code:
    <html>
    
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <meta name="GENERATOR" content="Microsoft FrontPage 4.0">
    <meta name="ProgId" content="FrontPage.Editor.Document">
    <title>New Page 1</title>
    </head>
    
    <body>
    
    <div align="center">
      <center>
      <table border="1" cellpadding="8" cellspacing="0" width="436">
        <tr>
          <td width="416" bgcolor="#000000"><font color="#FFE9B9"><!--webbot
            bot="HTMLMarkup" startspan --><SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript">
    <!-- //start
    
    dateFuture = new Date(2009,3,21,19,1,3);
    
    // TESTING: comment out the line below to print out the "dateFuture" for testing purposes
    //document.write(dateFuture +"<br />");
    
    
    //###################################
    //nothing beyond this point
    function GetCount(){
    
    	dateNow = new Date();									//grab current date
    	amount = dateFuture.getTime() - dateNow.getTime();		//calc milliseconds between dates
    	delete dateNow;
    
    	// time is already past
    	if(amount < 0){
    		document.getElementById('countbox').innerHTML="Now!";
    	}
    	// date is still good
    	else{
    		days=0;hours=0;mins=0;secs=0;out="";
    
    		amount = Math.floor(amount/1000);//kill the "milliseconds" so just secs
    
    		days=Math.floor(amount/86400);//days
    		amount=amount%86400;
    
    		hours=Math.floor(amount/3600);//hours
    		amount=amount%3600;
    
    		mins=Math.floor(amount/60);//minutes
    		amount=amount%60;
    
    		secs=Math.floor(amount);//seconds
    
    		if(days != 0){out += days +" day"+((days!=1)?"s":"")+", ";}
    		if(days != 0 || hours != 0){out += hours +" hour"+((hours!=1)?"s":"")+", ";}
    		if(days != 0 || hours != 0 || mins != 0){out += mins +" minute"+((mins!=1)?"s":"")+", ";}
    		out += secs +" seconds";
    		document.getElementById('countbox').innerHTML=out;
    
    		setTimeout("GetCount()", 1000);
    	}
    }
    
    window.onload=function(){GetCount();}//call when everything has loaded
    
    //-->
    </script>
    <div id="countbox"></div>
    <!--webbot bot="HTMLMarkup" endspan --></font></td>
        </tr>
      </table>
      </center>
    </div>
    
    </body>
    
    </html>
    Last edited by Kor; 03-24-2009 at 01:52 PM. Reason: wrap the code [code][/code]

  • #2
    Regular Coder
    Join Date
    Feb 2009
    Location
    Wheeling, IL
    Posts
    358
    Thanks
    5
    Thanked 62 Times in 60 Posts
    Actually, it does work in FireFox... only the font color is... black. Coming from the following:

    Code:
    <td width="416" bgcolor="#000000"><font color="#FFE9B9">
    Not sure exactly why you're using this kind of thing to achieve the white on black background, when you could do the following:

    Code:
    <style type="text/css">
    td {
        background-color: #000;
        color: #FFF;
    }
    </style>
    Which should work in both browsers.
    The way to success is to assume that there are no impossible things. After all, if you think something is impossible, you will not even try to do it.

    How to ask smart questions?

  • Users who have thanked Eldarrion for this post:

    madfun (04-27-2009)

  • #3
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,963
    Thanks
    79
    Thanked 4,426 Times in 4,391 Posts
    HUH??? #FFE9B9 is closer to white than to black. Black is #000000.

    The problem is, I think, the that <DIV> where he ACTUALLY puts the countdown is inside the <font>...</font> tags, and I don't think that's legal HTML. SO FF is probably just ignoring the <font> and/or is not rendering the <div>.

    Isn't that the worst place to dump a bunch of JS code you've seen in a while??? Good old sloppy FP.

  • Users who have thanked Old Pedant for this post:

    madfun (04-27-2009)

  • #4
    Regular Coder
    Join Date
    Feb 2009
    Location
    Wheeling, IL
    Posts
    358
    Thanks
    5
    Thanked 62 Times in 60 Posts
    Actually, no... thing is, FF is closing the <font> tags automatically before the script output... so it comes up something like:

    Code:
    <font color="#FFE9B9"></font>JavaScript Output</font> (his  own closing tag)
    Not sure why it would do that, though I'm guessing it has to do with the whole JS being stuck in the middle of nowhere or something else along those lines. All in all, don't see why anyone would want to use a deprecated tag - that being <font color>, when the same result can be accomplished with CSS... be it with:

    Code:
    <td style="width: 416px; background-color: #000; color: #FFE9B9;">
    or with <style> tags.

    EDIT: At a second glance, what the HTML validator I use complained about was that <div> cannot be contained within a <font> tag, so that's really the main reason the <font> tag doesn't affect the text output in FF(and probably in other browsers, except for IE).
    Last edited by Eldarrion; 03-24-2009 at 03:05 PM.
    The way to success is to assume that there are no impossible things. After all, if you think something is impossible, you will not even try to do it.

    How to ask smart questions?

  • #5
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,963
    Thanks
    79
    Thanked 4,426 Times in 4,391 Posts
    Yeah, what I said. <grin/>

    So FF plunks the </font> in there to keep the HTML legal. That makes a weird sort of sense.

    p.s.: Of course I agree with you re the use of <font>, but I also DETEST the way stupid FrontPage dumps JavaScript indiscriminately anyplace in the page. Blech.

  • #6
    Regular Coder
    Join Date
    Feb 2009
    Location
    Wheeling, IL
    Posts
    358
    Thanks
    5
    Thanked 62 Times in 60 Posts
    Quote Originally Posted by Old Pedant View Post
    p.s.: Of course I agree with you re the use of <font>, but I also DETEST the way stupid FrontPage dumps JavaScript indiscriminately anyplace in the page. Blech.
    Definitely have to agree with you on the dumping JavaScript in a completely random (at least from the looks of it) location. Though maybe it makes sense for the creators of the software. (I would name them, but for any WoT fan like me... speaking the name of the devil means to call his attention to yourself, so I'll refrain from doing so)
    The way to success is to assume that there are no impossible things. After all, if you think something is impossible, you will not even try to do it.

    How to ask smart questions?

  • #7
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,963
    Thanks
    79
    Thanked 4,426 Times in 4,391 Posts
    Hey, even DumbWaiter does better that FoulPage on JS handling. And doesn't it strike you as slightly evil that in order to get full benefit of FancyPants you have to have FP extensions installed on the server? Again, even DW doesn't require that bit of silliness.

  • #8
    Regular Coder
    Join Date
    Feb 2009
    Location
    Wheeling, IL
    Posts
    358
    Thanks
    5
    Thanked 62 Times in 60 Posts
    I ran FP once... about 5 or 6 years ago... and 5 minutes later, it was gone from my PC. So I had no idea about that issue... but yes, it is evil.
    The way to success is to assume that there are no impossible things. After all, if you think something is impossible, you will not even try to do it.

    How to ask smart questions?

  • #9
    New to the CF scene
    Join Date
    Mar 2009
    Location
    Los Angeles, CA
    Posts
    4
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Thanks again guys.... you rock. Could not have did it with out
    your input. One silly thing I was doing wrong was changing
    the script lower case to upper case.


  •  

    Posting Permissions

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