www.webdeveloper.com
Results 1 to 6 of 6

Thread: how to make font color red and font face verdana

  1. #1
    Join Date
    Jan 2010
    Posts
    72

    how to make font color red and font face verdana

    <html>
    <head>
    <script language="javascript">
    function call() {
    var result, fMath, fEng;
    fMath = parseInt(math.value);
    fEng = parseInt(eng.value);
    result = fMath+fEng;
    nResult.value = "<FONT COLOR="RED" FACE="VERDANA">" +result +"</FONT>";
    }
    </script>
    </head>
    <body>
    MATHEMATICS :<INPUT type="text" NAME="math"><br>
    ENGLISH :<INPUT type="text" NAME="eng"><br>
    RESULT :<TEXTAREA NAME="nResult" COLS="50" ROWS="50" READONLY></TEXTAREA><br>
    <input type="button" name="add" value="RESULT" onClick="call()">
    </body>
    </html>

    Thanks. On line 9th of this code snippet which is - nResult.value = "<FONT COLOR="RED">" +result +"</FONT>"; i want the result variable to appear in red in the textarea. This only restrieves it as string.
    Please help, how do i do it?
    Reply With Quote

  2. #2
    Join Date
    Jan 2010
    Posts
    72
    <html>
    <head>
    <script language="javascript">
    function call() {
    var result, fMath, fEng;
    fMath = parseInt(math.value);
    fEng = parseInt(eng.value);
    result = fMath+fEng;
    nResult.value = "<FONT COLOR="RED" FACE="VERDANA">" +result +"</FONT>";
    }
    </script>
    </head>
    <body>
    MATHEMATICS :<INPUT type="text" NAME="math"><br>
    ENGLISH :<INPUT type="text" NAME="eng"><br>
    RESULT :<TEXTAREA NAME="nResult" COLS="50" ROWS="50" READONLY></TEXTAREA><br>
    <input type="button" name="add" value="RESULT" onClick="call()">
    </body>
    </html>

    Thanks. On line 9th of this code snippet which is - nResult.value = "<FONT COLOR="RED" FACE="VERDANA">" +result +"</FONT>"; i want the result variable to appear in red in the textarea. This only restrieves it as string.
    Please help, how do i do it?
    Reply With Quote
    Edit/Delete Message
    Last edited by ken2010; 02-16-2010 at 10:05 AM. Reason: to add content

  3. #3
    Join Date
    Jan 2010
    Posts
    72
    <html>
    <head>
    <script language="javascript">
    function call() {
    var result, fMath, fEng;
    fMath = parseInt(math.value);
    fEng = parseInt(eng.value);
    result = fMath+fEng;
    nResult.value = "<FONT COLOR="RED" FACE="VERDANA">" +result +"</FONT>";
    }
    </script>
    </head>
    <body>
    MATHEMATICS :<INPUT type="text" NAME="math"><br>
    ENGLISH :<INPUT type="text" NAME="eng"><br>
    RESULT :<TEXTAREA NAME="nResult" COLS="50" ROWS="50" READONLY></TEXTAREA><br>
    <input type="button" name="add" value="RESULT" onClick="call()">
    </body>
    </html>

    Thanks. On line 9th of this code snippet which is - nResult.value = "<FONT COLOR="RED">" +result +"</FONT>"; i want the result variable to appear in red in the textarea. This only restrieves it as string.
    Please help, how do i do it?
    Reply With Quote
    Edit/Delete Message

  4. #4
    Join Date
    Mar 2007
    Posts
    31
    I'm not 100% sure but I think the <font> tag has been deprecated. Try using CSS
    Code:
    <style="COLOR="RED" FACE="VERDANA">

  5. #5
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    21,654
    RPJD that would be:
    Code:
    <style="color:red; font-face:verdana;">
    This is the full document of a previously post solution to your problem:
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html lang="en">
    <head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    
    <script type="text/javascript">
    function call() {
    var f = document.addition;
    var result, fMath, fEng;
    fMath = parseInt(f.math.value);
    fEng = parseInt(f.eng.value);
    result = fMath+fEng;
    f.nResult.value = result;
    f.nResult.style.color = 'red';
    }
    </script>
    
    <style type="text/css">
    label {display:block;}
    </style>
    
    </head>
    <body>
    <form action="#" name="addition">
    <div>
        <label>MATHEMATICS :<input type="text" name="math"></label>
        <label>ENGLISH :<input type="text" name="eng"></label>
        <label>RESULT :<textarea name="nResult" cols="50" rows="50" readonly></textarea></label>
        <input type="button" name="add" value="RESULT" onclick="call();">
    </div>
    </form>
    </body>
    </html>
    At least 98% of internet users' DNA is identical to that of chimpanzees

  6. #6
    Join Date
    Mar 2007
    Posts
    31
    Yes I did mean
    Code:
    style=""color:red; font-face:verdana;"
    My bad.

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