js实现百度搜索接口及链接功能
来源:互联网 发布:局域网内网监控软件 编辑:程序博客网 时间:2024/06/07 00:41
js实现百度搜索接口及链接功能
<!DOCTYPE html><html ng-app="myApp"><head><meta charset="UTF-8"><title>anchor</title><style>*{margin:0;padding:0;}#wei{width:500px;height:600px;margin:0 auto;border:0px solid gray;}#wei input{width:476px;height:50px;line-height: 50px;padding-left:20px;font-size: 16px;}#wei ul{height:auto;border:1px solid #ccc;display: none;}#wei ul li{width:100%;height:30px;line-height: 30px;text-indent:10px;font-size: 16px;list-style: none;}#wei ul li a{text-decoration:none;}#wei ul li:hover{display:block;background:#ccc;color:#fff;}</style></head><body ng-controller="show"><div id="wei"><input type="text" id="text"><ul id="list"></ul></div><script type="text/javascript">var txt = document.getElementById("text");var oUl = document.getElementById("list");txt.onkeyup = function(){var val = txt.value;var oScript = document.createElement("script");//动态创建script标签oScript.src = "https://sp0.baidu.com/5a1Fazu8AA54nxGko9WTAnF6hhy/su?wd="+val+"&cb=callback";//添加链接及回调函数document.body.appendChild(oScript);//添加script标签document.body.removeChild(oScript);//删除script标签}//回调函数function callback(data){var str="";for(var i=0;i<data.s.length;i++){str += "<li><a href=\"https://www.baidu.com/s?wd="+data.s[i]+"\">"+data.s[i]+"</a></li>";}//console.log(str);oUl.innerHTML=str;oUl.style.display="block";}</script></body></html>
1 0
- js实现百度搜索接口及链接功能
- angularjs实现百度的搜索接口及链接的实现
- Js实现百度搜索框提示功能(利用百度接口)
- jsonp结合百度接口-实现搜索功能
- 原生JS实现百度搜索api接口
- js/jQuery实现类似百度搜索功能
- js/jQuery实现类似百度搜索功能
- js实现百度搜索
- Js和Json技术实现百度搜索提示功能
- js模拟百度主页搜索功能
- 百度地图JS 搜索悬浮窗功能
- js实现搜索历史记录功能
- JavaScript实现百度搜索suggestion功能
- jqueryui实现百度推荐搜索功能
- 百度搜索框提示功能简单实现
- 利用百度OCR的node.js的接口实现文字识别的功能
- 使用视图链接功能 实现IAdaptable接口
- js实现百度搜索结果翻页效果
- ViewPager加载网络图片+自动轮播+小圆点指示
- gulp-clean----gulp系列(五)
- tomcat+redis+nginx 配置 达到负载 和 session 共享(redis方式)
- MySQL索引背后的数据结构及算法原理
- Android Studio之gradle的配置与介绍
- js实现百度搜索接口及链接功能
- hdu5777
- Adb学习
- 欧拉函数小结
- Android 适配心得
- hibernate xml 和 annotation 对比(一)
- 最长上升子序列
- 引用案例tricky
- HDU 4791 Alice's Print Service(二分)——2013 Asia Changsha Regional Contest