console
function clear_value(){
var input=document.getElementsByTagName("input")
var i;
for (i=0;i<input.length;i++){
input[i].value=" "
}
}
function sumbit(){
var a=document.getElementById("one").value
var h;
for (h=0;h<input.length;h++){
var b=a.charCodeAt()
document.getElementById("two").value=b
}
}
<html>
<head>
<title>字符转换ASCII码</title>
</head>
<body>
<img src="https://www.zenitour.com/img/logoIndex.png">
<hr>
<h1>字符转换成密码(ASCII码)</h1>
<input type="text"placeholder="请输入任意字符" id="one">
<button onclick="sumbit()">转换密码</button><br/>
<input type="text"placeholder="转换结果" id="two">
<button onclick="clear_value()">清空</button>