<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<input type="text" id="text">
<ul></ul>
<script type="text/javascript">
var t=document.getElementById("text");t.onblur=()=>{var v=t.value;
jsonp(v);
}
function fn(data){
var html='';
for (var i=0; i<data.s.length; i++) {
html += '<li><a target="_blank" href="http://www.baidu.com/s?wd='+data.s[i]+'">'+ data.s[i] +'</a></li>';
}
document.getElementsByTagName("ul")[0].innerHTML=html;
}
function jsonp(val){
var scr=document.createElement("script");
scr.src="http://suggestion.baidu.com/su?wd="+val+"&cb=fn";
document.head.appendChild(scr);
}</script>
</body>
</html>