[JavaScript] 类似于新浪微博搜索框弹出的效果 →→→→→进入此内容的聊天室

来自 , 2019-09-21, 写在 JavaScript, 查看 159 次.
URL http://www.code666.cn/view/a7471fdc
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
  5. <title>仿新浪微博搜索框弹出的效果</title>
  6. <style type="text/css">
  7. body{font-size:12px;}
  8. .weibo{width:500px; height:200px; position:relative;}
  9. .so{width:200px; height:24px; margin:30px;}
  10. .so #s_so{width:100px; border:1px solid #ccc; line-height:20px; height:20px;}
  11. #show{display:none; position:absolute; top:0px; left:10px; width:200px; height:60px; background:#fff; font-size:12px; border:1px solid #ccc; padding:10px;}
  12. #show span{margin-left:120px; color:#F00; cursor:pointer;}
  13. </style>
  14. </head>
  15.  
  16. <body>
  17. <script type="text/javascript">
  18. var $=function (id){
  19.         return document.getElementById(id);
  20.         }
  21. function s_show(){
  22. $('s_so').value="";
  23. $("show").style.display='block';
  24. $("b_so").focus();
  25. }
  26. function closed(){
  27. $("show").style.display='none';
  28. $('s_so').value="搜索他说的话";
  29. }
  30. </script>
  31. <div class="weibo">
  32.    <div class="so">
  33.    <form>
  34.     <input type="text" value="搜索他说的话" onfocus="s_show()" id="s_so"/><input type="submit" value="查找" />
  35.    </form>
  36.    </div>
  37.    <div id="show">
  38.    <p>搜索他说的话<span onclick="closed()">X</span></p>
  39.    <form>
  40.      <input type="text" value="" id="b_so"/><input type="submit" value="查找" />
  41.    </form>
  42.    </div>
  43. </div>
  44. </body>
  45. </html>
  46. //javascript/1079

回复 "类似于新浪微博搜索框弹出的效果"

这儿你可以回复上面这条便签

captcha