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.
Page 1 of 2 12 LastLast
Results 1 to 15 of 16

Thread: Date script....

  1. #1
    New Coder
    Join Date
    Feb 2005
    Location
    montreal (qc)
    Posts
    30
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation Date script....

    Hi, I have a script for the date but I want it in arial underline... how can i do that... here my script..( and if you have a shorter code (for the date in french...) I will like that...)

    Code:
    HERE THE HEAD PART... 
    
    <SCRIPT LANGUAGE="JavaScript">
    navvers = navigator.appVersion.substring(0,1);
    if (navvers > 3)
    	navok = true;
    else
    	navok = false;
    
    today = new Date;
    jour = today.getDay();
    numero = today.getDate();
    if (numero<10)
    	numero = "0"+numero;
    mois = today.getMonth();
    if (navok)
    	annee = today.getFullYear();
    else
    	annee = today.getYear();
    TabJour = new Array("Dimanche","Lundi","Mardi","Mercredi","Jeudi","Vendredi","Samedi");
    TabMois = new Array("janvier","février","mars","avril","mai","juin","juillet","aout","septembre","octobre","novembre","dééembre");
    messageDate = TabJour[jour] + " " + numero + " " + TabMois[mois] + " " + annee;
    </SCRIPT>
    
    HERE THE BODY PART... 
    
    <SCRIPT LANGUAGE="JavaScript">
    document.write(messageDate);
    </SCRIPT>

  • #2
    Senior Coder whizard's Avatar
    Join Date
    Jan 2005
    Location
    Philadelphia, PA, USA
    Posts
    1,662
    Thanks
    14
    Thanked 76 Times in 76 Posts

    Post

    CSS
    Code:
    p.date
    {
    font-family:Arial,Helvetica,Verdana;
    font-size:medium;
    color:#ff0000;
    }
    HTML/JS

    Code:
    <p class="date">
    <script>
    <!--
    document.write(messageDate);
    //-->
    </script>
    </p>
    Dan
    Last edited by whizard; 02-17-2005 at 12:15 AM. Reason: forgot closing script tag and code boxes; left p.date out of code wrapper
    PHP Tip: If you want to use short tags (<? or <?=$var) then make sure short_open_tag is set to "1". It really helps.

    Don't forget to save everyone time and mark your thread as Resolved :)

    "Also note that it is your responsibility to die() if necessary."

    DON'T USE THE MYSQL_ EXTENSION

  • #3
    New Coder
    Join Date
    Feb 2005
    Location
    montreal (qc)
    Posts
    30
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy

    im not good with css can you write the script with detail ( like head part...) thankyou!!!

  • #4
    Senior Coder whizard's Avatar
    Join Date
    Jan 2005
    Location
    Philadelphia, PA, USA
    Posts
    1,662
    Thanks
    14
    Thanked 76 Times in 76 Posts
    Code:
    <html>
    <head>
    <SCRIPT LANGUAGE="JavaScript">
    navvers = navigator.appVersion.substring(0,1);
    if (navvers > 3)
    	navok = true;
    else
    	navok = false;
    
    today = new Date;
    jour = today.getDay();
    numero = today.getDate();
    if (numero<10)
    	numero = "0"+numero;
    mois = today.getMonth();
    if (navok)
    	annee = today.getFullYear();
    else
    	annee = today.getYear();
    TabJour = new Array("Dimanche","Lundi","Mardi","Mercredi","Jeudi","Vendredi","Samedi");
    TabMois = new Array("janvier","février","mars","avril","mai","juin","juillet","aout","septembre","octobre","novembre","dééembre");
    messageDate = TabJour[jour] + " " + numero + " " + TabMois[mois] + " " + annee;
    </SCRIPT>
    
    <!-- Style for p.date -->
    <style>
    p.date
    {
    font-family:Arial,Helvetica,Verdana;
    font-size:medium;
    color:#ff0000; /*(red)*/
    }
    </style>
    
    </head>
    <body>
    <p class="date">
    <script>
    <!--
    document.write(messageDate);
    //-->
    </script>
    </p>
    </body>
    </html>
    ---OR---

    if you have an external style sheet,

    Code:
    <html>
    <head>
    <SCRIPT LANGUAGE="JavaScript">
    navvers = navigator.appVersion.substring(0,1);
    if (navvers > 3)
    	navok = true;
    else
    	navok = false;
    
    today = new Date;
    jour = today.getDay();
    numero = today.getDate();
    if (numero<10)
    	numero = "0"+numero;
    mois = today.getMonth();
    if (navok)
    	annee = today.getFullYear();
    else
    	annee = today.getYear();
    TabJour = new Array("Dimanche","Lundi","Mardi","Mercredi","Jeudi","Vendredi","Samedi");
    TabMois = new Array("janvier","février","mars","avril","mai","juin","juillet","aout","septembre","octobre","novembre","dééembre");
    messageDate = TabJour[jour] + " " + numero + " " + TabMois[mois] + " " + annee;
    </SCRIPT>
    
    <!-- Code to import ext. style sheet -->
    <link href="path/to/stylesheet" rel="stylesheet" type="text/css">
    </head>
    <body>
    <p class="date">
    <script>
    <!--
    document.write(messageDate);
    //-->
    </script>
    </p>
    </body>
    </html>
    Dan
    PHP Tip: If you want to use short tags (<? or <?=$var) then make sure short_open_tag is set to "1". It really helps.

    Don't forget to save everyone time and mark your thread as Resolved :)

    "Also note that it is your responsibility to die() if necessary."

    DON'T USE THE MYSQL_ EXTENSION

  • #5
    New Coder
    Join Date
    Feb 2005
    Location
    montreal (qc)
    Posts
    30
    Thanks
    0
    Thanked 0 Times in 0 Posts
    its don't work...

  • #6
    New Coder
    Join Date
    Sep 2004
    Location
    California
    Posts
    69
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by prise2admin
    its don't work...
    try it again it will work . i did test it .

  • #7
    Senior Coder whizard's Avatar
    Join Date
    Jan 2005
    Location
    Philadelphia, PA, USA
    Posts
    1,662
    Thanks
    14
    Thanked 76 Times in 76 Posts
    You mean the script doesnt output the date with an underline? Thats cause I forgot to put underline into the CSS code.

    Add this line to the CSS command (inbetween the <style> tags.)

    Code:
    text-decoration:underline;
    If the code isn't writing the date at all, then there's something wrong with the script, and I don't know JS at all really, but you should try the JS forum.

    Dan

    Yeah, I just tested it, and it works when you put the above code in.
    Dan
    Last edited by whizard; 02-17-2005 at 01:56 AM. Reason: trueviet911 slipped a post in in front of me
    PHP Tip: If you want to use short tags (<? or <?=$var) then make sure short_open_tag is set to "1". It really helps.

    Don't forget to save everyone time and mark your thread as Resolved :)

    "Also note that it is your responsibility to die() if necessary."

    DON'T USE THE MYSQL_ EXTENSION

  • #8
    New Coder
    Join Date
    Feb 2005
    Location
    montreal (qc)
    Posts
    30
    Thanks
    0
    Thanked 0 Times in 0 Posts
    when i try it in a new document it work but in my complete code it don' work so here my complete code:

    Code:
     erased...
    Last edited by prise2admin; 02-17-2005 at 02:14 AM.

  • #9
    Senior Coder whizard's Avatar
    Join Date
    Jan 2005
    Location
    Philadelphia, PA, USA
    Posts
    1,662
    Thanks
    14
    Thanked 76 Times in 76 Posts

    Exclamation

    Take out the exclamation points (!) from the ends of your comments on the first four lines and it'll work fine. What was happening was that you were commenting out the entire head section of your page, because of improperly coding the comment. therefore, the browser didn't know what "messagedate" was, and gave an error.

    Correct HTML comment: <!-- Blah Blah -->

    Also, just as friendly advice, you should clean up your code a little. There are a lot of un closed tags, and the like.

    Dan
    PHP Tip: If you want to use short tags (<? or <?=$var) then make sure short_open_tag is set to "1". It really helps.

    Don't forget to save everyone time and mark your thread as Resolved :)

    "Also note that it is your responsibility to die() if necessary."

    DON'T USE THE MYSQL_ EXTENSION

  • #10
    New Coder
    Join Date
    Feb 2005
    Location
    montreal (qc)
    Posts
    30
    Thanks
    0
    Thanked 0 Times in 0 Posts
    NOW ITS WORK!!!! thanks you for the tips...

  • #11
    New Coder
    Join Date
    Feb 2005
    Location
    montreal (qc)
    Posts
    30
    Thanks
    0
    Thanked 0 Times in 0 Posts
    but the date is not underlined how can i underline it...

  • #12
    Senior Coder whizard's Avatar
    Join Date
    Jan 2005
    Location
    Philadelphia, PA, USA
    Posts
    1,662
    Thanks
    14
    Thanked 76 Times in 76 Posts
    See post # 7 in this thread

    Also, don't feel stupid about the comments, check out this thread that I just
    replied to...

    Why don't the backgrounds show in my span tags?

    talk about stupidity on MY part....

    Dan
    PHP Tip: If you want to use short tags (<? or <?=$var) then make sure short_open_tag is set to "1". It really helps.

    Don't forget to save everyone time and mark your thread as Resolved :)

    "Also note that it is your responsibility to die() if necessary."

    DON'T USE THE MYSQL_ EXTENSION

  • #13
    New Coder
    Join Date
    Feb 2005
    Location
    montreal (qc)
    Posts
    30
    Thanks
    0
    Thanked 0 Times in 0 Posts
    sorry i dont view...

  • #14
    Senior Coder whizard's Avatar
    Join Date
    Jan 2005
    Location
    Philadelphia, PA, USA
    Posts
    1,662
    Thanks
    14
    Thanked 76 Times in 76 Posts
    add this in your style tag to get underlines:

    text-decoration:underline;

    Dan
    PHP Tip: If you want to use short tags (<? or <?=$var) then make sure short_open_tag is set to "1". It really helps.

    Don't forget to save everyone time and mark your thread as Resolved :)

    "Also note that it is your responsibility to die() if necessary."

    DON'T USE THE MYSQL_ EXTENSION

  • #15
    New Coder
    Join Date
    Feb 2005
    Location
    montreal (qc)
    Posts
    30
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i had viewing it before, i make a error my in my last post.. we are suposed to viee sory i had not view it...


  •  
    Page 1 of 2 12 LastLast

    Posting Permissions

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