Hi guys,
Can someone please help me to Format Numbers with commas. The script below have very large number without commas. To read numbers in trillions and billions are hard without commas to separate the numbers. By cutting and pasting the JavaScript below into a web editor you can clearly see what is happening. Please, help. Thank You,
freemld10
<html>
<head>
<title>Untitled</title>
<table width=”750″>
<tr>
<td align=”center”><h2>Days From Michael 21st Birthday</h2>
<form name=”count”>
<br><input type=”text”; font-family: verdana; font-size=”20″; size=”50″; name=”count2″>
</form>
<td>
</tr>
</table>
<script LANGUAGE=”JavaScript”>
/*
Count down script-
By JavaScript Kit ([url]www.javascriptkit.com
Over 200+ free scripts here!
//change the text below to reflect your own,
var before=”seconds”
var current=”Today is Year 3000!”
var montharray=new Array(“Jan”,”Feb”,”Mar”,”Apr”,”May”,”Jun”,”Jul”,”Aug”,”Sep”,”Oct”,”Nov”,”Dec”)
function countdown(yr,m,d){
theyear=yr;themonth=m;theday=d
var today=new Date()
var todayy=today.getYear()
if (todayy < 1000)
todayy+=1900
var todaym=today.getMonth()
var todayd=today.getDate()
var todayh=today.getHours()
var todaymin=today.getMinutes()
var todaysec=today.getSeconds()
var todaystring=montharray[todaym]+” “+todayd+”, “+todayy+” “+todayh+”:”+todaymin+”:”+todaysec
futurestring=montharray[m-1]+” “+d+”, “+yr
dd=Date.parse(futurestring)-Date.parse(todaystring)
dday=Math.floor(dd/(60*60*24)
dhour=Math.floor((dd%(60*60*24))/(60*1000)
dmin=Math.floor(((dd%(60*60*24))%(60*1000))/(60*1)
dsec=Math.floor((((dd%(60*1000*60*1000))/1000
if(dday==0&&dhour==0&&dmin==0&&dsec==1){
document.forms.count.count2.value=current
return
}
else
document.forms.count.count2.value=dday+ ” days, “+dhour+” hours, “+dmin+” minutes, and “+dsec+” “+before
setTimeout(“countdown(theyear,themonth,theday)”,1000)
}
//enter the count down date using the format year/month/day
countdown(1973,6,19)
</script>
<script LANGUAGE=”JavaScript”>
<!–
// Javascript Countdown
// Version 1.0 1/20/2000
// by TDavid at [url]http://www.tdscripts.com/
var now = new Date();
var event = new Date(“june 19 1973 00:00:01”);
var seconds = (event – now) / 1000;
var minutes = seconds / 60;
var hours = minutes / 60;
var days = hours / 24;
var weeks = days / 7;
var months = days / (365/12);
var years = days / 365
ID=window.setTimeout(“update();”, 1000);
function update() {
now = new Date();
seconds = (event – now) / 1000;
seconds = Math.round(seconds);
minutes = seconds / 60;
minutes = Math.round(minutes);
hours = minutes / 60;
hours = Math.round(hours);
days = hours / 24;
days = Math.round(days);
weeks = days / 7;
weeks = Math.round(weeks);
months = days / (365/12);
months = Math.round(months);
years = days / 365;
document.form1.seconds.value = seconds;
document.form1.minutes.value = minutes;
document.form1.hours.value = hours;
document.form1.days.value = days;
document.form1.weeks.value = weeks;
document.form1.months.value = months;
document.form1.years.value = years;
ID=window.setTimeout(“update();”,1000);
}
// –></script>
</head>
<p><font face=”Arial” size=”3″></font></p>
<form name=”form1″>
<br>
<table width= “720” border=”2″>
<tr>
<td colspan=”3″ align=”center”><b><font size=”5″ color=red face=”Arial, Geneva” >MICHAEL’S <br>Birthday CLOCK!!!</hr></font></br>
</td>
</tr>
<tr>
<td>Birthday Seconds—from June 19, 1973</td>
<td><input type=”text” name=”seconds” value=”0″ size=”10″></td>
<td>SECONDS</td>
</tr>
<tr>
<td>Birthday Minutes—-from June 19, 1973</td>
<td><input type=”text” name=”minutes” value=”0″ size=”10″></td>
<td>MINUTES</td>
</tr>
<tr>
<td>Birthday Hours——from June 19, 1973</td>
<td><input type=”text” name=”hours” value=”0″ size=”10″></td>
<td>HOURS</td>
</tr>
<tr>
<td>Birthday Days——-from June 19, 1973</td>
<td><input type=”text” name=”days” value=”0″ size=”10″></td>
<td>DAYS</td>
</tr>
<tr>
<td>Birthday Weeks—–from June 19, 1973</td>
<td><input type=”text” name=”weeks” value=”0″ size=”10″></td>
<td>WEEKS</td>
</tr>
<tr>
<td>Birthday Months—-from June 19, 1973</td>
<td><input type=”text” name=”months” value=”0″ size=”10″></td>
<td>MONTHS</td>
</tr>
<tr>
<td>Birthday Years——from June 19, 1973</td>
<td><input type=”text” name=”years” value=”0″ size=”10″></td>
<td>YEARS</td>
</tr>
</table>
</head>
<body>
</body>
</html>