• jquery用div实现下拉列表的效果


                        <script type="text/javascript">
                            function showSearchList() {
                                if ($('#searchList').is(":visible") == true) {
                                    $('#searchList').hide();
                                }
                                else {
                                    $('#searchList').show();
                                }
                            }
    
    
    
                            $(function() {
                                $('#serachDiv').blur(function() {   //这句很重要用来实现点击其他地方的时候,隐藏div(触发焦点事件)
                                     $('#searchList').hide();
                                })
                                $('#searchList li').click(function() {
                                    $("#searchCategory").html($(this).text());
                                    $('#searchList').hide();
                                });
                                $("#hightsearch").click(function() {
    
                                    window.open('/News/ZhengHeGaoJiSearch.aspx');
                                })
    
                            })
                           
                            function searchClink() {
                                var name = $.trim($("#searchCategory").text());
    
                                var title = escape($("#searchTitle").val());
                                if (title == '') {
                                    alert('关键词不能用空!');
                                    return;
                                }
                                var site;
                                switch (name) {
                                    case "政务新闻":
                                        site = '999';
                                        break;
                                    case "网上办事":
                                        site = '6';
                                        break;
                                    case "便民服务":
                                        site = '8';
                                        break;
                                    case "政府信息公开":
                                        site = '5';
                                        break;
                                    default:
                                        site = '7';
                                        break;
                                }
                                if (site == '6') {
                                    var url = '/2010/eService/eServiceItemList.aspx?type=0&title=' + title;
                                    window.open(url);
                                }
                                else if (site == '7') {
                                    var url = '/AuthorityPublic/AuthorityList.aspx?kw=' + title;
                                    window.open(url);
                                }
                                else if (site == '8') {
                                    var url = '/2010/Bmfw/SearchResult.aspx?fcheckbox=3&fullname=' + title;
                                    window.open(url);
                                }
                                else {
                                    var url = '/News/ResultSearch.aspx?searchType=&selectSite=' + site + '&keyword=' + title;
                                    window.open(url);
                                }
                            }
                        </script>
    
    
                            <div class="selectSearch" id="serachDiv">
                                <h1 onclick="showSearchList()" id="searchCategory">
                                    政务新闻</h1>
                                <div class="optionSearch" id="searchList" style="display: none;">
                                    <ul>
                                        <li class="bor_top">政务新闻</li>
                                        <li>网上办事</li>
                                        <li>便民服务</li>
                                        <li>政府信息公开</li>
                                        <li>行政职权公开</li>
                                    </ul>
                                </div>
                            </div>
  • 相关阅读:
    小菜菜mysql练习50题解析——数据准备
    C语言(数据结构)——概述
    运行 jar
    Hive 语句
    java14 IO流缓冲区 input output
    java 14 IO流
    java 14 图片的读取和写入
    java 集合的基础2
    java 13 hashmao的entryset()
    java 13 集合的基础
  • 原文地址:https://www.cnblogs.com/wenghaowen/p/3358868.html
Copyright © 2020-2023  润新知