<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<input type="text" id="aaa">
</body>
</html>
2 回答
微积分2016
TA贡献53条经验 获得超69个赞
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Document</title> </head> <body> <input type="text" id="t1" /> <script type="text/javascript"> var init=function () { var t1=document.getElementById("t1"); t1.oninput=function () { console.log(t1.value); }; // IE t1.onpropertychange=function () { console.log(t1.value); }; }; window.onload=init; </script> </body> </html>
千秋此意
TA贡献158条经验 获得超187个赞
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Title</title> </head> <body> <input type="text" id="aaa"> <script> var input = document.getElementById('aaa'); var timer = null; input.onkeyup = function() { clearTimeout(timer); timer = setTimeout(function() { console.log(input.value); }, 500); } </script> </body> </html>
添加回答
举报
0/150
提交
取消