<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
* {
padding: 0;
margin: 0
} .sousuo {
width: 300px;
height: 40px;
position: absolute;
margin: auto;
top: 0;
left: 0;
bottom: 0;
right: 0;
} li {
list-style: none;
line-height: 30px;
padding: 0 10px;
} li:hover {
background-color: #777;
color: #fff;
} ul {
position: absolute;
display: none;
}
</style>
</head>
<body>
<input type="text" class="sousuo"/>
<ul class="ul"></ul>
<script src="../blog/javascripts/jquery-1.7.2.min.js"></script>
<script> function position() {
var sousuo = $(".sousuo");
$(".ul").css({
top: sousuo.offset().top + sousuo.height() + 5,
left: sousuo.offset().left,
width: sousuo.css("width")
})
}
function demo(data) {
var ul = $('.ul');
var html = '';
if (data.s.length) {
ul.css("display",'block');
for (var i = 0; i<data.s.length; i++) {
html +='<li>'+data.s[i]+'</li>';
}
ul.html(html);
}
}
$(".ul").delegate("li",'click',function () {
location.href = 'https://www.baidu.com/s?wd='+$(this).text();
});
$(document).ready(function () {
position();
$('.sousuo').on('keyup', function () {
if (this.value) {
var script = document.createElement("script");
script.src = 'https://sp0.baidu.com/5a1Fazu8AA54nxGko9WTAnF6hhy/su?wd='+this.value+'&cb=demo';
document.body.appendChild(script);
}
});
});
window.onresize = function () {
position();
}
</script>
</body>
</html>

最新文章

  1. 6.LibSVM核函数
  2. Servlet技术(使用myeclipse)
  3. python之面向对象
  4. linux下的apache配置文件详解
  5. Ruby Unit Test
  6. angularjs移除不必要的$watch
  7. 升级tomcat7的运行日志框架到log4j2,可以打进kafka
  8. Uva12206 Stammering Aliens 后缀数组&amp;&amp;Hash
  9. 普通工程转为mvn工程
  10. 集成代码编辑器ACE的经验
  11. Python科学计算(二)windows下开发环境搭建(当用pip安装出现Unable to find vcvarsall.bat)
  12. 从一个新手容易混淆的例子简单分析C语言中函数调用过程
  13. java Thread.join()
  14. linux vi 中s 替换方法
  15. Android最新源码4.3下载-教程 2013-11
  16. ThinkPHP3.2 常量参考
  17. AtCoder Regular Contest 077
  18. ansible工具
  19. Ubuntu常用软件
  20. python基础——循环(for,while,break,continue)

热门文章

  1. 请问在一个固定div大小里面,图片右移动,超出div容器的图片给隐藏,怎么设定?
  2. leetcood学习笔记-172-阶乘后的0
  3. NX二次开发-UFUN查询对象的类型和子类型UF_OBJ_ask_type_and_subtype
  4. 2018-2019-2-20175323 java实验四 Android程序设计
  5. Rootkit之SSDT hook(通过CR0)
  6. git tag操作
  7. Spring源码由浅入深系列三 refresh
  8. ElasticSearch 索引查询使用指南
  9. Landsat数据下载与介绍
  10. HTML5的特殊标签与IE浏览器的兼容