JS 实现可伸缩搜索框
2013-07-10 11:28
239 查看
<!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> <script type="text/javascript" src="jquery-1.8.3.js"></script> <script type="text/javascript"> $(function(){ $('#ser').blur(function(){ var sval = $('#ser').val(); if(sval != ""){ $('#ser').attr('style','width:250px'); }else{ $('#ser').attr('style','width:130px'); } }); $('#ser').click(function(){ $('#ser').attr('style','width:250px'); }); }); </script> <style type="text/css"></style> <style> .demo_search { display:inline-block; position:relative; height:27px; margin:60px; } .demo_search:hover { -webkit-box-shadow:0 0 3px #999; -moz-box-shadow:0 0 3px #999 } .demo_search .demo_sinput { float:left; width:130px; height:19px; line-height:19px; padding:3px 5px; border:#A7A7A7 1px solid; background:white; color:#888; font-size:12px; -webkit-transition:.3s; -moz-transition:.3s; outline: none; } .demo_search .demo_sbtn { cursor:pointer; height:27px; font-size:12px; float:left; width:50px; margin-left:-1px; background:#eee; display:inline-block; padding:0 12px; vertical-align:middle; border:#A7A7A7 1px solid; color:#666; } .demo_search .demo_sbtn:hover { background:#ddd; }</style> </head> <body> <form class="demo_search" action="" method="post"> <input class="demo_sinput" type="text" name="s" id="ser"/> <input class="demo_sbtn" type="submit" value="搜索" /></form> </body> </html>
相关文章推荐
- JS+CSS实现仿新浪微博搜索框的方法
- JS实现搜索框文字可删除
- js与jquery实现搜索框提示文字显示与隐藏
- js实现YouKu的漂亮搜索框效果
- 基于Vue.js 2.0实现百度搜索框效果
- JS实现网页右侧带动画效果的伸缩窗口代码
- JS实现搜索框文字可删除功能
- JS实现横向拉伸动感伸缩菜单效果代码
- 搜索框根据输入自动提示--js实现
- 可伸缩搜索框 旋转实现loading
- html用js实现导航栏的二级菜单,自动伸缩。。。
- JS实现网页右侧带动画效果的伸缩窗口代码
- 二级分类JS实现,伸缩重叠效果
- JS实现搜索框绑定回车键示例
- js实现搜索框提示字的特效------------获取焦点和失去焦点
- Js+ajax实现智能百度搜索框
- fieldset可伸缩JS实现
- js实现智能提示搜索框
- JS实现京东首页之页面顶部、Logo和搜索框功能
- 原生js和jquery分别实现伸缩菜单的制作-水平方向导航栏