1 replies
  • SEO
  • |
Hey Guys,

I'm looking for the javascript code that will update the date on a landing page.

The closest I could find was

Code:
<div style="color:Black;">
<script type="text/javascript">
var d=new Date()
var weekday=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
var monthname=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
document.write(weekday[d.getDay()] + " ")
document.write(d.getDate() + ". ")
document.write(monthname[d.getMonth()] + " ")
document.write(d.getFullYear())
</script>
</div>
The only problem is, I can't figure out how to change the font style or bold it. Does anyone know how to do this,or know of a better code? Thanks in advance
#java #quick
  • Profile picture of the author paulgl
    You can just use old-fashioned html before and after the
    javascript. Yes, you can use the document.write to add
    it if you wish. Here is an example of a big, bold, arial, red
    date using good old fashioned html and skip the <div>:

    <big><b><font size="6" color="red" face="arial">
    <script type="text/javascript">
    var d=new Date()
    var weekday=new Array("Sunday","Monday","Tuesday","Wednesday","Thu rsday","Friday","Saturday")
    var monthname=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","A ug","Sep","Oct","Nov","Dec")
    document.write(weekday[d.getDay()] + " ")
    document.write(d.getDate() + ". ")
    document.write(monthname[d.getMonth()] + " ")
    document.write(d.getFullYear())
    </script>
    </font>
    </b></big>

    You might have been under the impression that the javascript
    ignores previous defined fonts. A clue would have been to look
    at the <div> style just before.

    Just change the font size, color, font to whatever. Keep in mind
    fancy fonts may not be recognized.

    You could also change it using the div tag.

    My opinion is to leave it default black/font as is.

    Paul
    Signature

    If you were disappointed in your results today, lower your standards tomorrow.

    {{ DiscussionBoard.errors[1322154].message }}

Trending Topics