Results 1 to 2 of 2

Thread: Change Font in Javascript

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2006
    Posts
    8

    Arrow Change Font in Javascript

    Hi,
    How do i change the font and font size of the messages....
    What this code does is: It display a message or tip each day...it's a monthly tip of the day..



    Code:
    <script language="JavaScript">
    
    var msg = new Array();
    Stamp = new Date();
    today = Stamp.getDate();
    
    msg[0]="Sometimes doing nothing is better than trying to fill the space!"
    msg[1]="When you become more quiet you are more open, you are more able to hear, to listen!"
    msg[2]="Don't compromise yourself. You're all you've got!"
    msg[3]="All the troubles of man come from his not knowing how to sit still!"
    msg[4]="Life doesn't require that we be the best - only that we try our best!"
    msg[5]="They get bored with childhood. They rush to grow up and then long to be children again!"
    msg[6]="Becoming yourself is easy but ending your false personality is hard!"
    msg[7]="Tomorrow or the next life - which comes first, we never know!"
    msg[8]="Mirrors should be able to think before reflecting the image!"
    msg[9]="Nothing is a waste of time if you use the experience wisely!"
    msg[10]="He alone is great who turns the voice of the wind into a song made sweeter by his own loving!"
    msg[11]="One day your life is going to flash before your eyes.Make sure it's worth watching!"
    msg[12]="If you know that you don't know, that is a great beginning. Then it is possible for you to know!"
    msg[13]="To meet everything and everyone through stillness instead of mental noise is the greatest gift you can offer to the universe!"
    msg[14]="What lies behind us and what lies before us are tiny matters compared to what lies within us!"
    msg[15]="Courage is the price life exacts for granting peace!"
    msg[16]="There are no mistakes, no coincidences. All events are blessings given to us to learn from!"
    msg[17]="When the doors of perception are cleansed, things will appear to man as they truly are, infinite!"
    msg[18]="Emancipate yourselves from mental slavery, non but ourselves can free our minds!"
    msg[19]="Love is the only flower that grows and blossoms without the aid of the seasons!"
    msg[20]="Failure is not the worst thing in the world. The worst is not to try!"
    msg[21]="Have no destination, and you will not get lost!"
    msg[22]="Nothing is a waste of time if you use the experience wisely!"
    msg[23]="If I keep a green bough in my heart, the singing bird will come!"
    msg[24]="Wisdom ceases to be wisdom when it becomes too proud to weep, too grave to laugh, and too self-full to seek other than itself!"
    msg[25]="All your answers lie inside of you. All you need to do is look, listen and trust!"
    msg[26]="This life and world are full of opposites. Opposites - wherever you look it is all opposites. Isn't it amazing?"
    msg[27]="Truth is a country without road!"
    msg[28]="The only real voyage of discovery consists not in seeking new landscapes but in having new eyes!"
    msg[29]="The waves of terror never reach the shore of Freedom, where the tide of Love is ever Strong"
    msg[30]="Security and changelessness are fabricated by the ego-dominated mind and do not exist in nature!"
    //write todays tip so that the tip number matches with the day
    document.write(msg[today-1]);

  2. #2
    VB6, XHTML & CSS hobbyist Merri's Avatar
    Join Date
    Oct 2002
    Location
    Finland
    Posts
    6,654

    Re: Change Font in Javascript

    CSS:

    p.life { font : "Courier New", "Courier", sans-serif; }


    JavaScript:

    msg[0]="<p class=\"life\">Sometimes doing nothing is better than trying to fill the space!</p>"


    Just use different CSS classes and you get different results.

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