手机
当前位置:查字典教程网 >编程开发 >Javascript教程 >javascript实现类似于新浪微博搜索框弹出效果的方法
javascript实现类似于新浪微博搜索框弹出效果的方法
摘要:本文实例讲述了javascript实现类似于新浪微博搜索框弹出效果的方法。分享给大家供大家参考。具体实现方法如下:仿新浪微博搜索框弹出的效果...

本文实例讲述了javascript实现类似于新浪微博搜索框弹出效果的方法。分享给大家供大家参考。具体实现方法如下:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>仿新浪微博搜索框弹出的效果</title> <style type="text/css"> body{font-size:12px;} .weibo{width:500px; height:200px; position:relative;} .so{width:200px; height:24px; margin:30px;} .so #s_so{width:100px; border:1px solid #ccc; line-height:20px; height:20px;} #show{display:none; position:absolute; top:0px; left:10px; width:200px; height:60px; background:#fff; font-size:12px; border:1px solid #ccc; padding:10px;} #show span{margin-left:120px; color:#F00; cursor:pointer;} </style> </head> <body> <script type="text/javascript"> var $=function (id){ return document.getElementById(id); } function s_show(){ $('s_so').value=""; $("show").style.display='block'; $("b_so").focus(); } function closed(){ $("show").style.display='none'; $('s_so').value="搜索他说的话"; } </script> <div> <div> <form> <input type="text" value="搜索他说的话" onfocus="s_show()" id="s_so"/> <input type="submit" value="查找" /> </form> </div> <div id="show"> <p>搜索他说的话<span>X</span></p> <form> <input type="text" value="" id="b_so"/><input type="submit" value="查找" /> </form> </div> </div> </body> </html>

运行效果如下:

javascript实现类似于新浪微博搜索框弹出效果的方法1

希望本文所述对大家的javascript程序设计有所帮助。

【javascript实现类似于新浪微博搜索框弹出效果的方法】相关文章:

js实现文本框选中的方法

JavaScript实现鼠标滑过处生成气泡的方法

javascript实现十秒钟后注册按钮可点击的方法

javascript实现在网页任意处点左键弹出隐藏菜单的方法

JavaScript中用于生成随机数的Math.random()方法

js+html5实现canvas绘制圆形图案的方法

javascript验证邮件地址和MX记录的方法

Javascript实现每日自动换一张图片的方法

javascript元素动态创建实现方法

Javascript实现飞动广告效果的方法

精品推荐
分类导航