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 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Nov 2004
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Really,Really Easy Problem

    Im sure one of you will see a mistake in a second but im trying to do this and I need help. The date and time nor the text will appear on the screen when I open it up in the browser.

    Code:
    <SCRIPT LANGUAGE="javascript">
    //Coded by indy
    RightNow = getDate();
    document.write
    ("<FONT COLOR='GREEN'>Welcome! You stopped by on:</FONT> " +  (RightNow.getMonth()+1) + "/" + RightNow.getDate() + "/" + RightNow.getFullYear() ")
    </SCRIPT>
    This wont be the only question I have in my quest to learn JS so if anyone could help I would greatly appreciate it

  • #2
    New to the CF scene
    Join Date
    Sep 2004
    Location
    USA
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You need to place " " at the beginning and end. "Welcome -----on:"
    You're right I forget sometimes myself.
    I dont know if anything else is wrong.
    I am just learning also.
    Wolfy

  • #3
    New to the CF scene
    Join Date
    Nov 2004
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    It still doesnt work

    Heres what I have now :

    Code:
    <SCRIPT type="text/javascript">
    //Coded by Zach Day
    RightNow = getDate();
    document.write
    ("<FONT COLOR='GREEN'>"Welcome! You stopped by on:"</FONT> " +  (RightNow.getMonth()+1) + "/" + RightNow.getDate() + "/" + RightNow.getFullYear()")
    </SCRIPT>

  • #4
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Code:
    <SCRIPT type="text/javascript">
    //Coded by Zach Day
    RightNow = new Date();
    document.write
    ("<FONT COLOR='GREEN'>"Welcome! You stopped by on:"</FONT> " +  (RightNow.getMonth()+1) + "/" + RightNow.getDate() + "/" + RightNow.getFullYear()")
    </SCRIPT>
    .....Willy

  • #5
    Regular Coder
    Join Date
    Sep 2002
    Posts
    428
    Thanks
    0
    Thanked 20 Times in 20 Posts
    The first time you posted it:

    <SCRIPT LANGUAGE="javascript">
    //Coded by indy
    RightNow = getDate();
    document.write
    ("<FONT COLOR='GREEN'>Welcome! You stopped by on:</FONT> " + (RightNow.getMonth()+1) + "/" + RightNow.getDate() + "/" + RightNow.getFullYear() ")
    </SCRIPT>

    you just needed to change getDate() to new Date()
    and the last parenthese? you don't need it.



    <SCRIPT LANGUAGE="javascript">
    RightNow = new Date();
    document.write("<FONT COLOR='GREEN'>Welcome! You stopped by on:</FONT>" +(RightNow.getMonth()+1) + "/" +RightNow.getDate()+ "/"+RightNow.getFullYear()) // no parenthese after fullyear()
    </SCRIPT>
    NO Limits!! www.dhcreationstation.com
    ------------------------------------------------------------
    Broken items wanted for tinkerin'! PostItNow@BrokenEquipment.com

  • #6
    New to the CF scene
    Join Date
    Nov 2004
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by c1lonewolf
    The first time you posted it:

    <SCRIPT LANGUAGE="javascript">
    //Coded by indy
    RightNow = getDate();
    document.write
    ("<FONT COLOR='GREEN'>Welcome! You stopped by on:</FONT> " + (RightNow.getMonth()+1) + "/" + RightNow.getDate() + "/" + RightNow.getFullYear() ")
    </SCRIPT>

    you just needed to change getDate() to new Date()
    and the last parenthese? you don't need it.



    <SCRIPT LANGUAGE="javascript">
    RightNow = new Date();
    document.write("<FONT COLOR='GREEN'>Welcome! You stopped by on:</FONT>" +(RightNow.getMonth()+1) + "/" +RightNow.getDate()+ "/"+RightNow.getFullYear()) // no parenthese after fullyear()
    </SCRIPT>
    Thanks lone Wolf

    It works now, thanks guys


  •  

    Posting Permissions

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