close
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style type="text/css">
span{
color: darkRed;
}
</style>
</head>
<body>
<input type="text" id="type">
<h2>您輸入了<span id="remind"></span>個字</h2>
<h2>您輸入的ASCII碼為 <span id="keyCode"></span> </h2>
<script type="text/javascript">
document.getElementById('type').onkeyup=function(e){
document.getElementById('keyCode').innerHTML=e.keyCode;
document.getElementById('remind').innerHTML=e.target.value.length;
}
</script>
</body>
</html>
全站熱搜