• 模拟自定义下拉菜单


    <!DOCTYPE html>
    <html lang="zh-cn">
    
        <head>
            <meta charset="utf-8" />
            <title></title>
    
        </head>
    
        <body>
    
            <style type="text/css">
                .xmkc {
                    width: 600px;
                    margin: 0 auto;
                    text-align: center;
                    position: relative;
                }
                
                .wena {
                    display: block;
                    border: 1px solid #ddd;
                    width: 320px;
                    height: 26px;
                    font-size: 12px;
                    line-height: 26px;
                    vertical-align: middle;
                    margin: 0px;
                    padding: 0px;
                    cursor: pointer;
                }
                
                .classlist {
                    width: 320px;
                    border-left: 1px solid #ddd;
                    border-bottom: 1px solid #ddd;
                    border-right: 1px solid #ddd;
                    position: absolute;
                    z-index: 1;
                    left: 0px;
                    top: 28px;
                }
                
                .lis {
                    display: block;
                    margin: 0px;
                    padding: 0px;
                }
                
                .lis a {
                    display: block;
                    width: 320px;
                    height: 20px;
                    font-size: 12px;
                    padding-top: 8px;
                    text-align: left;
                    text-decoration: none;
                    color: #333;
                    outline: none;
                    hide-focus: expression_r(this.hideFocus=true);
                }
                
                .lis a:hover {
                    text-decoration: none;
                    background-color: #00f452;
                    color: #fff;
                }
            </style>
    
            <script type="text/javascript">
                function $(x) {
                    return document.getElementById(x);
                   
                }
    
                function sh(x) {
                    $(x).style.display = $(x).style.display ? "" : "none";
                }
    
                function gets_value(str) {
                    $('whole').value = str;
                    sh('hh');
                }
            </script>
    
            <body>
    
                <div class="xmkc">
                    <input name="class" id="whole" type="text" class="wena" onClick="sh('hh')" value="你最喜欢吃的水果是" readonly="readonly" />
    
                    <div id="hh" style="display:none" class="classlist">
    
                        <div class="lis"><a href="#" onClick="gets_value('香蕉')">香蕉</a></div>
                        <div class="lis"><a href="#" onClick="gets_value('苹果')">苹果</a></div>
                        <div class="lis"><a href="#" onClick="gets_value('梨')"></a></div>
                        <div class="lis"><a href="#" onClick="gets_value('水蜜桃')">水蜜桃</a></div>
    
                    </div>
                    <!--classlist -->
                </div>
                <!--xmkc -->
    
            </body>
    
    </html>
  • 相关阅读:
    2013/11/21工作随笔-PHP开启多进程
    php中mysql操作的buffer知识
    你不一定懂的cpu显示信息
    好文收藏系列(三)
    doctrine2到底是个什么玩意
    制作火焰图(纯笔记)
    《精通Linux内核必会的75个绝技》知识杂记
    BIG5, GB(GB2312, GBK, ...), Unicode编码, UTF8, WideChar, MultiByte, Char说明与区别
    sed替换换行符“ ”
    mysql将字符串字段转为数字排序或比大小
  • 原文地址:https://www.cnblogs.com/q460021417/p/5203534.html
Copyright © 2020-2023  润新知