www.webdeveloper.com
Results 1 to 6 of 6

Thread: bold font?

  1. #1
    Join Date
    Apr 2009
    Posts
    46

    bold font?

    I have a script that makes random text messages.

    it starts like so

    <center>
    <font color="#71025F" size="2" face="Verdana,Arial">
    <script language="JavaScript">
    //
    so its giving font color size and font,

    I am a complete newbie to javascript, I find free scripts scripts and edit them to my needs, I dont know much about javascript, but what I do know it is very, very usefull, I use simple scripts but get a lot of milage from them to my needs, and it really helps me a lot.

    Now I have a very basic question, I have searched but I am not bringing anything up, probably becuase its so very simple.

    In the code above we can see its giving commands for the code that will proceed it for the fonts in the script.

    What I want to know, wait for it, how do I make it bold.

    I was almost to embarrased to ask such a simple question, but I found conflicting answers, and hey, I am a newbie that has to use other peoples scripts, then apply what little knowledge I have to edit them to my own needs. I tend to use the same scripts over and over, so once I have a new one, it gets used a lot of times for different projects. Like I said, I get a lot of milage from them, and an very gratefull that javascripters make them available for people to use in their projects.

  2. #2
    Join Date
    Nov 2003
    Location
    Worthington, OH, USA
    Posts
    3,634
    The font and center tags have been deprecated so let's use a span tag and inline CSS (if you're doing a lot of this it would be better to set up a CSS class ):

    HTML Code:
    <span style="text-align:center;color:#71025F;font-size:.8em;font-family:Verdana,Arial;font-weight:bold;">
    <script type="text/javascript">
    Your code here....
    </script>
    </span>
    54 68 65 42 65 61 72 4D 61 79

  3. #3
    Join Date
    Apr 2009
    Posts
    46
    This is my script, its pretty neat.
    How would I edit in yourscript, and also, now you see the whole script, would you use your script differently within it.

    <center>
    <font color="#71025F" size="2" face="Verdana,Arial">
    <script language="JavaScript">
    // ==============================================
    // Copyright 2004 by CodeLifter.com
    // Free for all; but please leave in this header.
    // ==============================================

    var Quotation=new Array() // do not change this!

    // Set up the quotations to be shown, below.
    // To add more quotations, continue with the
    // pattern, adding to the array. Remember
    // to increment the Quotation[x] index!

    Quotation[1] = "A sentance here.";
    Quotation[2] = "Say words.";
    Quotation[3] = "Blar Blar.";
    Quotation[4] = "Talking again.";

    // ======================================
    // Do not change anything below this line
    // ======================================
    var Q = Quotation.length;
    var whichQuotation=Math.round(Math.random()*(Q-1));
    function showQuotation(){document.write(Quotation[whichQuotation]);}
    showQuotation();
    </script>
    I guess this is how we would use your script within it.

    <center>
    <span style="text-align:center;color:#71025F;font-size:.8em;font-family:Verdana,Arial;font-weight:bold;">
    <script type="text/javascript">
    // ==============================================
    // Copyright 2004 by CodeLifter.com
    // Free for all; but please leave in this header.
    // ==============================================

    var Quotation=new Array() // do not change this!

    // Set up the quotations to be shown, below.
    // To add more quotations, continue with the
    // pattern, adding to the array. Remember
    // to increment the Quotation[x] index!

    Quotation[1] = "A sentance here.";
    Quotation[2] = "Say words.";
    Quotation[3] = "Blar Blar.";
    Quotation[4] = "Talking again.";

    // ======================================
    // Do not change anything below this line
    // ======================================
    var Q = Quotation.length;
    var whichQuotation=Math.round(Math.random()*(Q-1));
    function showQuotation(){document.write(Quotation[whichQuotation]);}
    showQuotation();
    </script>
    </span>
    Is this what you would do, or something else?

  4. #4
    Join Date
    Nov 2003
    Location
    Worthington, OH, USA
    Posts
    3,634
    Actually just an HTML element with some CSS, but you're on the right track...
    54 68 65 42 65 61 72 4D 61 79

  5. #5
    Join Date
    Apr 2009
    Posts
    46
    I pasted this in, nothing else to it, just this only.

    <center>
    <span style="text-align:center;color:#71025F;font-size:.8em;font-family:Verdana,Arial;font-weight:bold;">
    <script type="text/javascript">
    // ==============================================
    // Copyright 2004 by CodeLifter.com
    // Free for all; but please leave in this header.
    // ==============================================

    var Quotation=new Array() // do not change this!

    // Set up the quotations to be shown, below.
    // To add more quotations, continue with the
    // pattern, adding to the array. Remember
    // to increment the Quotation[x] index!

    Quotation[1] = "A sentance here.";
    Quotation[2] = "Say words.";
    Quotation[3] = "Blar Blar.";
    Quotation[4] = "Talking again.";

    // ======================================
    // Do not change anything below this line
    // ======================================
    var Q = Quotation.length;
    var whichQuotation=Math.round(Math.random()*(Q-1));
    function showQuotation(){document.write(Quotation[whichQuotation]);}
    showQuotation();
    </script>
    </span>
    once we get over font-size:.9em, like font-size:.10em, the type is tiny, how do we go bigger than 9.

    Also just as a referance, what would of been the command for the bold font in the 'first' script, not your altered one.

    <center>
    <font color="#71025F" size="2" face="Verdana,Arial">
    <script language="JavaScript">
    What would we have put in to get bold in that one, I just want to know so I can make notes of the code, comes in handy when I am doing other projects and I experiment and see what works.

  6. #6
    Join Date
    Apr 2009
    Posts
    46
    Right so about your script, something is wrong as we cannot go over 9em or the text goes micro small. Copy and paste it your script, change the font over 10 in size, see, the font has shrunk down to nothing.

    Ill settle for the plain and simple command that just adds the bold to the first one, if possible, I dont want to mess about, once I have this, I am done with what I am working on and can give you some piece on this forum, and I can get on with my other work.


    Is there anyone here bar TheBearMay, I think if he wasnt here Id be talking to myself.
    Last edited by Sunny Day; 06-11-2009 at 01:02 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles