要求显示当前系统的时间
显示登录页面的时间
能够处理输入的字符,把输入的字符对应的码值输出出来
<!DOCTYPE html>
<html><head>
<style type="text/css">
span{color: red;}
</style>
<meta charset="UTF-8">
<title></title>
<script type="text/javascript">
setInterval("showTimeNow()",100);
var dateBegin = new Date();
function showTimeNow(){
var dateNow = new Date();
document.getElementById("spanId").innerHTML= dateNow.toLocaleString();
var date1 = dateBegin;
var chaDate = dateNow - dateBegin;
//alert(chaDate);
document.getElementById("spanIdHour").innerHTML= parseInt(chaDate/1000/60/60);
document.getElementById("spanIdMin").innerHTML=parseInt(chaDate/1000/60);
document.getElementById("spanIdTimeSec").innerHTML=parseInt(chaDate/1000);
}
function getNum(){
var textNum = document.getElementById("textId").value;
document.getElementById("spanText").innerHTML= textNum;
var str = "";
for(var i=0; i<textNum.length;i++){
str = str + textNum.charCodeAt(i)+" ";
}
document.getElementById("spanA").innerHTML = str;
}
</script>
</head>
<body οnlοad="showTimeNow()">
当前系统时间是:<span id="spanId"></span><br />
当前页面已停留时间:<span id="spanIdHour"></span>小时 <span id="spanIdMin"></span>分钟<span id="spanIdTimeSec"></span> 秒<br />
请输入字符:<input type="text" id="textId" /><input type="button" value="执行" id="btnId" οnclick="getNum()"/> <br />
您输入的字符数: <span id="spanText"></span> 它的ASII码是:<span id="spanA"></span>
</body>
</html>