ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
# 搜索模块 ### 搜索条 ![](https://box.kancloud.cn/2016-08-26_57bfba92b006b.png) 相关代码如下: ``` <div class="aui-searchbar-wrap demo" id="search"> <div class="aui-searchbar aui-border-radius" tapmode onclick="doSearch()"> <i class="aui-iconfont aui-icon-search"></i> <div class="aui-searchbar-text">请输入搜索内容</div> <div class="aui-searchbar-input"> <form action="javascript:search();"> <input type="text" placeholder="请输入搜索内容" id="search-input"> </form> </div> <i class="aui-iconfont aui-icon-roundclosefill" tapmode onclick="clearInput()"></i> </div> <div class="aui-searchbar-cancel aui-text-info" tapmode onclick="cancelSearch()">取消</div> </div> <script type="text/javascript"> function doSearch(){ $api.addCls($api.dom(".aui-searchbar-wrap"),"focus"); $api.dom('.aui-searchbar-input input').focus(); } function cancelSearch(){ $api.removeCls($api.dom(".aui-searchbar-wrap.focus"),"focus"); $api.val($api.byId("search-input"),''); $api.dom('.aui-searchbar-input input').blur(); } function clearInput(){ $api.val($api.byId("search-input"),''); } function search(){ var content = $api.val($api.byId("search-input")); if(content){ api.alert({ title: '搜索提示', msg: '您输入的内容为:'+content }); }else{ api.alert({ title: '搜索提示', msg: '您没有输入任何内容' }); } cancelSearch(); } </script> ```