当我按页面中的其他位置时,如何关闭此菜单? [英] How Do I make this menu close when i press somewhere else in the page?

查看:50
本文介绍了当我按页面中的其他位置时,如何关闭此菜单?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

JavaScript:

JavaScript:

<script type="text/javascript">
    $(document).ready(function() {

        $(".sign_in").click(function() {
            $("#sign_box").show();
            return false;
        });
        $("body #main").click(function() {
            $("#sign_box").hide();
            return false;
        });
    });
</script>



CSS:



Css:

<script type="text/javascript">
    $(document).ready(function() {

        $(".sign_in").click(function() {
            $("#sign_box").show();
            return false;
        });
        $("body #main").click(function() {
            $("#sign_box").hide();
            return false;
        });
    });
</script>



HTML:



Html:

<div id="sign_box">
<table>
<tr><td><td height= 15px></td></td></tr>
    <tr><td>Username:</td><td><asp:TextBox ID="user" runat="server" width=100px/></td></tr>
    <tr><td><td  height= 15px></td></td></tr>
    <tr><td>Password:</td><td><asp:TextBox ID="pass" runat="server" width=100px TextMode=Password/></td></tr>
    <tr><td><td height= 15px></td></td></tr>
    <tr><td colspan="2"><center><asp:Button ID="Button1" runat="server" Text="Login"

            onclick="Button1_Click1" /></center></td></tr>
            <tr><td><td  height=10px></td></td></tr>
    <tr><td colspan="2">
        <asp:Label ID="Label4" runat="server" Text="*Username And Password Don`t Much" Font-Size=XX-Small ForeColor=Red></asp:Label></td></tr>

</table>

推荐答案

(document).ready(function(){
(document).ready(function() {


(.sign_in").click(function (){
(".sign_in").click(function() {


(#sign_box").show(); 返回false; });
("#sign_box").show(); return false; });


这篇关于当我按页面中的其他位置时,如何关闭此菜单?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆