<html>
<body>
<form action="demo_keygen.asp" method="get">
Username: <input type="text" name="usr_name">
Encryption: <keygen id="myKeygen" name="security">
<input type="submit">
</keygen></form>
<p>点击 "点我" 按钮返回表单元素中 keygen 字段的类型。</p>
<p id="demo"></p>
<button onclick="myFunction()">点我</button>
<script>
function myFunction()
{
var x = document.getElementById("myKeygen").type;
document.getElementById("demo").innerHTML=x;
}
</script>
</body>
</html>