zoukankan      html  css  js  c++  java
  • 鼠标滑入滑出,输入框获得失去焦点后触发事件的N种方法之一二

    熟悉position的用法

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="UTF-8">
    <script src="http://apps.bdimg.com/libs/angular.js/1.4.6/angular.min.js"></script>
    <script src="jquery/jquery-1.11.3.min.js"></script>
    <title>输入框获得焦点,显示div 点击别处div隐藏</title>
    </head>
    <style>
    .page_modal{
    position: absolute;
    top:0px;
    left:0px;
    border:1px solid red;
    100%;
    height:100%;
    display:none;
    z-index:2000;
    }
    .div_text{
    200px;
    position: absolute;
    margin:0px;
    padding:0px;
    background-color:blue;
    display:none;
    z-index:2001;
    opacity:0.5;
    }
    a{

    }
    a:hover{
    cursor:pointer;
    color:black;
    }

    </style>
    <body>
    <div>
    <input type="text" id="inp_only"onmouseover="$('#div_show').show();"onmouseout="$('#div_show').hide();" onfocus="inpFocus()" onkeyup="inpFocus()"/>
    </div>
    <div class="div_text" id="div_show" onmouseover="$('#div_show').show();" onmouseout="$('#div_show').hide();"></div>
    <div class="page_modal"></div>
    </body>
    <script>
    $(function(){
    $(".page_modal").click(function(){
    // $(".page_modal").hide();
    $("#div_show").hide();
    });
    })
    $("#div_show>a").click(function(){
    var textVal = $(this).val();
    // $(".page_modal").hide();
    $("#div_show").hide();
    $("#inp_only").val(textVal);
    })
    function inpFocus(){
    $("#div_show").html("");
    var $a = "";
    for(var i=0;i<5;i++){
    $a += "<a href='javascript:void(0);' style='display:block;color:white'>1.1.1."+i+"</a>";
    }
    $("#div_show").append($a);
    // $(".page_modal").show();
    $("#div_show").show();
    }

    </script>
    </html>



                        常常因为自己的无知而感到惶恐.
                                              ---Jun.
  • 相关阅读:
    RandomAccessFile类
    IO_ObjectOutputStream(对象的序列化)
    IO流_文件切割与合并(带配置信息)
    IO流_文件切割与合并
    IO流_SequenceInputStream(序列流)
    10-stack
    9-queue
    16-两种方法全排列
    8-全排列next_permutation
    15-Call to your teacher(有向图的连通判断)
  • 原文地址:https://www.cnblogs.com/moli-/p/5707326.html
Copyright © 2011-2022 走看看