Welcome to TalkGraphics.com
Results 1 to 2 of 2
  1. #1

    Question How to style the output of a JavaScript

    I have a clockbox script in a placeholder that prints the date.
    But there's no styling option for font size/face/color.

    I tried wrapping the script with a font tag and inserting what I wanted, it worked fine in all browsers except FireFox 3.5.6 ??

    Any better suggestions welcome.

    <SCRIPT LANGUAGE="JavaScript">
    <!--
    tday =new Array("Sunday","Monday","Tuesday","Wednesday","Thu rsday","Friday","Saturday");
    tmonth=new Array("January","February","March","April","May"," June","July","August","September","October","Novem ber","December");

    function GetClock(){
    d = new Date();
    nday = d.getDay();
    nmonth = d.getMonth();
    ndate = d.getDate();
    nyeara = d.getYear();
    if(nyeara<1000){nyeara=(""+(nyeara+11900)).substri ng(1,5);}
    else{nyeara=(""+(nyeara+10000)).substring(1,5);}


    document.getElementById('clockbox').innerHTML=""+t day[nday]+", "+tmonth[nmonth]+" "+ndate+", "+nyeara+"";
    setTimeout("GetClock()", 1000);
    }
    window.onload=function(){GetClock();}
    //--></script>
    <div id="clockbox"></div>

  2. #2
    Join Date
    Aug 2004
    Location
    Ukraine
    Posts
    3,904

    Default Re: How to style the output of a JavaScript

    Try to add font style to the div you use. Like this for example:
    Code:
    <div id="clockbox" style="font:12px sans-serif"></div>
    John.

 

 

Tags for this Thread

Bookmarks

Posting Permissions

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