Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!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" xml:lang="en" lang="en">
<head>
<title>Sandbox</title>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<style type="text/css" media="screen">
body { background-color: #CCC; font: 16px Helvetica, Arial; color: #fff; }
</style>
</head>
<body>
<input type="text" id="character" size="15"  value="a">
<input type="button" value="Show Key Code" onclick="showKeyCode();">
</body>
</html>
 
function showKeyCode()
{
  var str = document.getElementById ( "character" ).value;
  var  code = str.charCodeAt(str.length-1);
var stringall = document.getElementById ( "character" ).value;
var msg = "The Key Code for the \""+stringall+"\" character is "+code+".";
console.log(msg);
}
Output

This bin was created anonymously and its free preview time has expired (learn why). — Get a free unrestricted account

Dismiss x
public
Bin info
anonymouspro
0viewers