You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
<!DOCTYPE html>
< -- 本 文 件 在 edge 浏 览 器 下 稳 定 运 行 , 不 知 道 为 什 么 会 出 现 有 时 候 无 法 正 常 运 行 -- >
< head >
< meta charset = "UTF-8" >
< title > test_001< / title >
< script src = "https://cdn.bootcdn.net/ajax/libs/jquery/3.4.1/jquery.min.js" > < / script >
< / head >
< body >
< div id = "top01" >
< p id = "top02" > 这是一段文字< / p >
< input type = "text" id = "in" / >
< button onclick = "getInput()" > < / button >
< / div >
< / body >
< script >
let name ;
function getInput ( ) {
name = document . getElementById ( 'in' ) . value ;
$ . getJSON ( "js/JSONTEST.json" , function ( data ) {
for ( i in data . Title ) {
if ( data . Title [ i ] . includes ( name , 0 ) ) name = data . Title [ i ] ;
}
Title . innerHTML = ( name ) ;
console . log ( data ) ;
} ) ;
console . log ( name ) ;
}
let Title = document . getElementById ( 'top02' ) ;
< / script >
< / html >