JS的dom获取用户名

Lophole 2019-12-29

<!DOCTYPE html><html lang="en"><head>    <meta charset="UTF-8">    <title>JSDom获取图层节点</title></head><body><script type="text/javascript">    function getUsername() {        var dom=document.getElementById("username");        var name=dom.value;        alert(name);    }</script><input type="text" id="username"><input  type="button" value="获取用户名" onclick="getUsername()"></body></html>

相关推荐