/    Sign up×
Community /Pin to ProfileBookmark

Setting Font in output

I have a very basic Date and Time script that I would like to modify to have the output as the Verdana font. I have looked all over for anwser but everything I find give an error…. Here is the script:

<script language=”JavaScript” type=”text/javascript”>

<!–// This array holds the “friendly” day names

var day_names = new Array(7)
day_names[0] = “Sunday”
day_names[1] = “Monday”
day_names[2] = “Tuesday”
day_names[3] = “Wednesday”
day_names[4] = “Thursday”
day_names[5] = “Friday”
day_names[6] = “Saturday”

// This array holds the “friendly” month names
var month_names = new Array(12)
month_names[0] = “January”
month_names[1] = “February”
month_names[2] = “March”
month_names[3] = “April”
month_names[4] = “May”
month_names[5] = “June”
month_names[6] = “July”
month_names[7] = “August”
month_names[8] = “September”
month_names[9] = “October”
month_names[10] = “November”
month_names[11] = “December”

// Get the current date
date_now = new Date()

// Figure out the friendly day name
day_value = date_now.getDay()
date_text = day_names[day_value]

// Figure out the friendly month name
month_value = date_now.getMonth()
date_text += ” ” + month_names[month_value]

// Add the day of the month
date_text += ” ” + date_now.getDate()

// Add the year
date_text += “, ” + date_now.getFullYear()

// Get the minutes in the hour
minute_value = date_now.getMinutes()
if (minute_value < 10) {
minute_value = “0” + minute_value

}

//Get the hour value and use it to customize the greeting
hour_value = date_now.getHours()
if (hour_value == 0) {
greeting = “Good morning, “
time_text = ” – ” + (hour_value + 12) + “:” + minute_value + ” AM”
}
else if (hour_value < 12) {
greeting = “Good morning!”
time_text = ” – ” + hour_value + “:” + minute_value + ” AM”
}
else if (hour_value == 12) {
greeting = “Good afternoon!”
time_text = ” – ” + hour_value + “:” + minute_value + ” PM”
}
else if (hour_value < 17) {
greeting = “Good afternoon!”
time_text = ” – ” + (hour_value – 12) + “:” + minute_value + ” PM”
}
else {
greeting = “Good evening!”
time_text = ” – “+ (hour_value – 12) + “:” + minute_value + ” PM”
}

document.write(date_text + time_text)

//–>
</script>

Can someone point me in the right direction??

Thanks!

Mike

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@DJRobThaManDec 09.2005 — you tried doing it in css?

I don't know if it would work with things printed out using javascript but i think it should

just add the following in the within the head tags

[CODE]
<style type="text/css">
body
{
font-family: Verdana;
}
</style>
[/CODE]
Copy linkTweet thisAlerts:
@swancottauthorDec 09.2005 — Okay... You can shoot me now.. :eek:

I tried that but did not place in the right place... argh!

Thanks!

Mike
×

Success!

Help @swancott spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...