I have a date counter with this html:
%26lt;script language=';JavaScript'; type=';text/javascript';%26gt;
%26lt;!--
var
month = new Array();
month[0]=';January';;
month[1]=';February';;
month[2]=';March';;
month[3]=';April';;
month[4]=';May';;
month[5]=';June';;
month[6]=';July';;
month[7]=';August';;
month[8]=';September';;
month[9]=';October';;
month[10]=';November';;
month[11]=';December';;
var
day = new Array();
day[0]=';Sunday';;
day[1]=';Monday';;
day[2]=';Tuesday';;
day[3]=';Wednesday';;
day[4]=';Thursday';;
day[5]=';Friday';;
day[6]=';Saturday';;
today = new Date();
date = today.getDate();
day = (day[today.getDay()]);
month = (month[today.getMonth()]);
year = (today.getFullYear());
suffix = (date==1 || date==21 || date==31) ? ';st'; : ';th'; %26amp;%26amp;
(date==2 || date==22) ? ';nd'; : ';th'; %26amp;%26amp; (date==3 || date==23) ? ';rd'; : ';th';
function print_date()
{
document.write(day + ';,'; + ';聽'; + date + ';%26lt;sup%26gt;'; + suffix + ';%26lt;/sup%26gt;'; + ';聽'; +
month + ';,'; + ';聽'; + year);
}
// --%26gt;
%26lt;/script%26gt;
%26lt;script%26gt;
%26lt;!--
print_date();
//--%26gt;
%26lt;/script%26gt;
But when I use it, it appears in Times New Roman. I do not like Times New Roman, I would like it to be in arial, and colour; #006599; and a smaller font perhaps.
Can anyone help me? And please don't tell me to visit an html site, because I have tried. I'm asking you.
Thanks X)How to change font in html script?
Try adding this to script at point shown:
document.write(%26lt;span style=';font-family: arial; color: #006599;';%26gt;day + ';,'; + '; '; + date + ';%26lt;sup%26gt;'; + suffix + ';%26lt;/sup%26gt;'; + '; '; +
month + ';,'; + '; '; + year%26lt;\/span%26gt;);
RonHow to change font in html script?
Wow thanks, you can see my website use your help! At:
http://www.economicsgeek.com
Report Abuse
step 1: change this function in your script
================================
function print_date()
{
document.getElementById('spnDate').inn鈥?= day + ';,'; + '; '; + date + ';%26lt;sup%26gt;'; + suffix + ';%26lt;/sup%26gt;'; + '; '; +
month + ';,'; + '; '; + year;
}
============================
step 2: and change add a %26lt;span%26gt; element where you want the date to be displayed. use the style attribute of the span element to style it.
============================
%26lt;body%26gt;
%26lt;span id=';spnDate'; style=';font-family:Arial;font-size:10px;鈥?br>
%26lt;/body%26gt;
before the script
%26lt;style type=';text/css';%26gt;
body
{
font: arial; font-size: 12; color: #006599;
}
%26lt;/style%26gt;
this will apply to all text typed on your html to be arial, size 12 and color
Insert the styling tag and its preferences to where I have below;
%26lt;!--
%26lt;style%26gt;
font size=';12'; face=';Arial'; color=';#006599';
%26lt;/style%26gt;
var
month = new Array();
Hope this helps! =D
You might try visiting an html site and see if you can find any additional help there such as w3schools
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.