Results 1 to 2 of 2

Thread: change the size and font color in document.write

  1. #1
    Join Date
    Nov 2007
    Posts
    69
    Thanks
    36
    Thanked 0 Times in 0 Posts

    Default change the size and font color in document.write

    hi
    i want to change the font size to 4 and color to red for the following
    i tried using <font size=4></font> inside the document.write but did not got the result
    Code:
    <script type = "text/javascript">
    var myDate = new Date();
    var today = new Date();
    var dd = today.getDate();
    var dy = today.getDay();
    var offset = Math.abs(2 - dy);
    dd = dd - offset;
    myDate.setDate(today.getDate() - offset)
    var dateToDisplay = "";
    if (myDate < today) {
    dateToDisplay = myDate;
    									}
    else {
    dateToDisplay = today;
    									}
    var a=dateToDisplay.getDate();
    var b=dateToDisplay.getMonth();
    document.write(a + "/" + b);
    								
    </script>
    smile always
    anand
    Last edited by meenakshi; 05-23-2008 at 01:51 PM. Reason: code error

  2. #2
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    Add CSS styling to the div that you're writing to instead of using deprecated tags within the javascript.

    <div style="color:red;font-size:12px;">
    <!-- SCRIPT OUTPUT -->
    </div>

  3. The Following User Says Thank You to Medyman For This Useful Post:

    meenakshi (05-27-2008)

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
  •