Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Date & Time not showing

Jasmine AlmasriJasmine Almasri Member Posts: 5

I was doing a tutorial based on this
https://dcccd.blackboard.com/bbcswebdav/pid-9660635-dt-content-rid-35811711_1/courses/2017SP-ITSE-1411-33420/2016SP-ITSE-1411-32440_ImportedContent_20151217112856/ITSE_1411_DateTime.pdf
and for some reason, the date and time would not show, could you tell me what is wrong. This is the code I used.

<?xml version="1.0" encoding="UTF-8" ?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">



Tulsa's New Year's Bash


<script type="text/javascript src="functxt.js">

function NYClock () { var today = new Date; document.clockform.dateNow.value = showDate(today); document.clockform.timeNow.value = showTime(today); var days = calcDays(today); document.clockform.daysLeft.value = Math.floor(days); var hours = (days - Math.Floor(days))*24; document.clockform.hrLeft.value = math.floor(hours); var minutes = (hours - Math.floor(hours))*60; document.clockform.minLeft.value = Math.floor(minutes); var seconds = (minutes - Math.floor(minutes))*60; document.clockform.secLeft.value = Math.floor(seconds); }

<

form name="clockform" id="clockform" action="">

Date and Time



Countdown

Days
Hours
Minutes
Seconds

Tulsa's New Year's Bash is back for the 22nd year of fun and excitement. The festivities start on December 31 at noon with the FrostiRun 5K and 10K races. Sign up now or the morning of the race. Family fun is available at the Kid's Korner with booths and free activities for the whole family; including performances from Tulsa's own Chester the Jester. The fun continues with A Taste of Tulsa as vendors provide samples from Tulsa's best eateries and for the artistically inclined, plan to attend the Winter Art Fair on Tulsa's downtown square.

Music from Lester's Blues Band and The Jazz Express brings us into the New Year. The dancing starts at 7 p.m. and continues until midnight. From 10 to 11 p.m. we say goodbye to the old year (and ring in the new) with the famous New Year's Bash fireworks spectacular. Be sure to arrive early for all of the festivities and the final countdown.

New Year's Bash · 340 Main Street, Tulsa, OK 74102 · 555 - 3481

for functxt.js

function showDate(dateObj)
{
thisDate = dateObj.getDate();
thisMonth = dateObj.getMonth()+1;
thisYear = dateObj.getFullYear();
return thisMonth + "/" + thisDate + "/" +thisYear;
}

function showTime(dateObj)
{
thisSecond=dateObj.getSeconds();
thisMinute=dateObj.getMinutes();
thisHour=dateObj.getHours();

var ampm = (thisHour < 12 ? " a.m." : " p.m.");

thisHour = (thisHour > 12) ? thisHour - 12 : thisHour;

thisHour = (thisHour == 0) ? 12 : thisHour;

thisMinute = thisMinute < 10 ? "0"+thisMinute : thisMinute;
thisSecond = thisSecond < 10 ? "0"+thisSecond ; thisSecond;

return thisHour + ":" + thisMinute + ":" + thisSecond + ampm;

}

function calcDays
{
newYear = new Date("January 1, 2011");
nextYear = currentDate.getFullYear()+1;
newYear.setFullYear(nextYear);

days = (newYear - currentDate)/(1000*60*60*24);

return days;

}

Sign In or Register to comment.