36 lines
879 B
HTML
36 lines
879 B
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Document</title>
|
|
</head>
|
|
|
|
<body>
|
|
<input type="text" placeholder="关键字">
|
|
</body>
|
|
<script>
|
|
var arr = ["在干嘛", "在吃饭", "写作业", "写吃饭", "干什么", "是什么", "是吃饭", "玩游戏", "玩什么"]
|
|
var aaaa = [];
|
|
$("input").oninput = function () {
|
|
aaaa = []
|
|
console.dir(
|
|
$("input").value.length != 0
|
|
);
|
|
arr.forEach(function (v, i) {
|
|
if (v.includes($("input").value)) {
|
|
aaaa.push(v)
|
|
console.log(aaaa);
|
|
}
|
|
})
|
|
}
|
|
|
|
|
|
function $(className) {
|
|
return document.querySelector(className)
|
|
}
|
|
</script>
|
|
|
|
</html> |