var now = new Date()
document.write(1900 + now.getYear() + "-" + (now.getMonth() + 1) + "-" + now.getDate() + " " + now
.getHours() + ":" + now.getMinutes() + ":" + now.getSeconds())
var input = document.getElementById('btn')
var oUl = document.getElementById('ul')
input.onkeyup = function () {
var value = this.value;
var oScript = document.createElement('script');
oScript.src = 'https://sp0.baidu.com/5a1Fazu8AA54nxGko9WTAnF6hhy/su?wd=' + value + '&cb=aa'
// 核心在这里,
// 1.实时获取参数 value
// 2.cb=返回值的处理函数(aa)
document.body.appendChild(oScript)
}
function aa(data) {
oUl.style.display = 'block';
var list = data.s;
var str = '';
if (list.length > 0) {
list.forEach(function (ele, index) {
str += '
' + ele + '';})
oUl.innerHTML = str;
} else {
oUl.style.display = 'none';
}
}
一键复制
编辑
Web IDE
原始数据
按行查看
历史