Update test01.html

main
pqjepwfgk 8 months ago
parent 9f6fe0097e
commit 20b79afe32

@ -1,34 +1,34 @@
<!DOCTYPE html> <!DOCTYPE html>
<--edge-->
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>test_001</title> <title>test_001</title>
<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
</head> </head>
<body> <body>
<div id = "top01"> <div id = "top01">
<p id="top02">这是一段文字</p> <p id="top02">这是一段文字</p>
<input type="text" id="in"/> <input type="text" id="in"/>
<button onclick="getInput()"></button> <button onclick="getInput()"></button>
</div> </div>
</body> </body>
<script> <script>
let name; let name;
function getInput(){ function getInput(){
name = document.getElementById('in').value; name = document.getElementById('in').value;
$.getJSON("js/JSONTEST.json",function(data){ $.getJSON("js/JSONTEST.json",function(data){
for(i in data.Title){ for(i in data.Title){
if(data.Title[i].includes(name,0)) name = data.Title[i]; if(data.Title[i].includes(name,0)) name = data.Title[i];
} }
Title.innerHTML = (name); Title.innerHTML = (name);
console.log(data); console.log(data);
}); });
console.log(name); console.log(name);
} }
let Title = document.getElementById('top02'); let Title = document.getElementById('top02');
</script> </script>
</html> </html>
Loading…
Cancel
Save