jsonp跨域百度
来源:互联网 发布:历史周期律 知乎 编辑:程序博客网 时间:2024/06/05 11:28
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title></title> <style type="text/css"> * { margin: 0; padding: 0; } #txt { width: 300px; height: 40px; border: 1px solid #f99; font-size: 14px; font-family: "微软雅黑"; } #list { width: 300px; border: 1px solid #0f0; display: none; } #list li { width: 300px; height: 30px; font-size: 14px; list-style: none; } #list li a { display: block; line-height: 30px; color: #000; font-family: "微软雅黑"; text-decoration: none; } #list li a:hover { background: #f99; color: #fff; } </style> <script type="text/javascript"> window.onload = function() { var oTxt = document.getElementById('txt'); oTxt.onkeyup = function() { var val = this.value; var oScript = document.createElement('script'); oScript.src = "https://sp0.baidu.com/5a1Fazu8AA54nxGko9WTAnF6hhy/su?wd=" + val + "&cb=callback" document.body.appendChild(oScript); document.body.removeChild(oScript); } }; function callback(data) { console.log(data.s[0]); console.log(data); var oList = document.getElementById('list'); var html = '' if (data.s.length > 0) { for (var i = 0; i < data.s.length; i++) { html += '<li><a href="https://www.baidu.com/s?wd=' + data.s[i] + '" target="_blank">' + data.s[i] + '</a></li>' } oList.style.display = 'block'; oList.innerHTML = html; }else{ oList.style.display = 'none'; } } </script> </head> <body> <input type="text" id="txt" /> <ul id="list"> <li> <a href=""></a> </li> </ul> </body> </html>
阅读全文
0 0
- jsonp跨域百度
- jsonp跨域百度
- jsonp实现跨域调用百度地图接口
- JSONP跨域请求+简答实现百度搜索
- jsonp跨域学习以百度为例
- jsonp 跨域原理:深入浅出 jsonp
- 百度等搜索引擎智能提示(JSONP跨域实现自动补全搜索建议)
- jsonp百度下拉实例
- jsonp 跨域访问
- JSONP跨域访问
- jsonp跨域访问
- jsonp跨域请求
- jsonp跨域劣势
- jsonp 跨域学习
- jsonp 跨域请求
- Jsonp 跨域访问
- 跨域访问jsonp
- Jsonp 跨域访问
- A child container failed during异常解决
- 【736c677c4】log4j多模块配置文件模板 (含注释及优先级说明)
- CAS实现多线程计数器
- 寻找ZCMU
- 可绑定可扩展的帐号系统设计原理及其实现
- jsonp跨域百度
- mysql毫秒测试
- 第一篇python爬虫
- Moore-Penrose伪逆
- 【Android】【UI】透明度转十六进制
- OnTouchListenner
- CSS常见兼容性问题总结
- python3中,用Tkinter编写记事本功能
- mysql错误指令:Failed to open file "file_name" error 2/error 22