- Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<script language="JavaScript">
function disptime() {
var time = new Date()
var hour = time.getHours()
var minute = time.getMinutes()
var second = time.getSeconds()
var temp = "" + ((hour > 12) ? hour - 12 : hour)
temp += ((minute < 10) ? ":0" : ":") + minute
temp += ((second < 10) ? ":0" : ":") + second
temp += (hour >= 12) ? " P.M." : " A.M."
document.MyPage.digits.value = temp
id = setTimeout("disptime()",1000)
}
//-->
</SCRIPT>
</HEAD>
<BODY onLoad="disptime()">
<P><font color = hotpink size = 4>Time and Tide wait for none. <BR><BR>
<P> The time is displayed on the page.
<BR><BR><BR>
<FORM NAME="MyPage">
<INPUT TYPE="text" NAME="digits" SIZE=12 VALUE="">
</FORM>
</BODY>
</html>
có gì các bạn đóng góp ý kiến nhé