Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ajax/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 在web2py中,什么不单击函数加载?_Jquery_Ajax_Web2py - Fatal编程技术网

Jquery 在web2py中,什么不单击函数加载?

Jquery 在web2py中,什么不单击函数加载?,jquery,ajax,web2py,Jquery,Ajax,Web2py,我在索引页中有一个链接 {if not auth.user:}} <li> <a href="#" id="pop" onclick="$('#overlay_form').load('/tskasiav3/default/user1');">Login</a></li> {{pass}} 并且在用户页面中有相同的链接。onclick活动在用户页面中工作,但在索引页面中不工作。关于为什么它不起作用有什么帮助吗 <link r

我在索引页中有一个链接

{if not auth.user:}}
    <li> <a href="#" id="pop" onclick="$('#overlay_form').load('/tskasiav3/default/user1');">Login</a></li>
    {{pass}}
并且在用户页面中有相同的链接。onclick活动在用户页面中工作,但在索引页面中不工作。关于为什么它不起作用有什么帮助吗

<link rel="stylesheet" type="text/css" href="{{=URL('static','css/tskasia.css')}}" />

<doctype html>

<head>
    <link rel="stylesheet" type="text/css" href="{{=URL('static','css/tskasia.css')}}" />
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
    <script type="text/javascript">
    $(document).ready(function(){
//open popup
        $("#pop").click(function(){
            $("#overlay_form").fadeIn(1000);
            positionPopup();
        });

//close popup
        $("#close").click(function(){
            $("#overlay_form").fadeOut(500);
        });
    });

    //position the popup at the center of the page
    function positionPopup(){
        if(!$("#overlay_form").is(':visible')){
            return;
        }
        $("#overlay_form").css({
            left: ($(window).width() - $('#overlay_form').width()) / 2,
            top: ($(window).width() - $('#overlay_form').width()) / 7,
            position:'absolute'
        });
    }

    //maintain the popup at center of the page when browser resized
    $(window).bind('resize',positionPopup);

</script>
    <style>
        #overlay_form{
            position: absolute;
            border: 5px solid limegreen;
            padding: 10px;
            background: white;

        }
        #pop{
            display: block;

            width: 80px;
            text-align: center;
            padding: 6px;
            border-radius: 5px;
            text-decoration: none;
            margin: 0 auto;
        }

}
    </style>





<body class="home">

<div id="container">
<header>

    <img src="{{=URL('static','images/header.png')}}" id="header" />

</header>

<nav>

<ul class="navigation">
   <li><a class="home" href="index.html">Home</a></li>
    <li><a class="about" href="about.html">About</a></li>
    <li><a class="product" href="products.html">Products</a></li>
    <li><a class="contact" href="contact.html">Contact</a></li>
    <li><a class="bookings" href="bookings.html">Bookings</a></li>
     <li><a class ="User" href="user1/profile">{{if auth.user:}}Account{{pass}}</a></li>

     {{if not auth.user:}}
    <li> <a href="#" id="pop" onclick="$('#overlay_form').load('/tskasiav3/default/user1');">Login</a></li>
    {{pass}}
    {{if auth.user:}}
    <li><a class ="Logout" href="user1/logout" id="Logout">Logout</a></li>
    {{pass}}

</ul>

    </nav>

<br />
<div id="overlay_form" style="display:none">
    <h2>{{=T( request.args(0).replace('_',' ').capitalize() )}}</h2>
<div id="web2py_user_form">

</div>


    </div>


    {{
if request.args(0)=='login':
    if not 'register' in auth.settings.actions_disabled:
        form.add_button(T('Register'),URL(args='register', vars={'_next': request.vars._next} if request.vars._next else None),_class='btn')
    pass
    if not 'request_reset_password' in auth.settings.actions_disabled:
        form.add_button(T('Lost Password'),URL(args='request_reset_password'),_class='btn')
    pass

pass



}}

    <script language="javascript">jQuery("#web2py_user_form input:visible:enabled:first").focus();
    {{if request.args(0)=='register':}}
    web2py_validate_entropy(jQuery('#auth_user_password'),100);
    {{elif request.args(0)=='change_password':}}
    web2py_validate_entropy(jQuery('#no_table_new_password'),100);
    {{pass}}
    </script>

    </div>
    </body>
    </head>
    </doctype>
这在索引页中

<doctype html>
<head>
    <link rel="stylesheet" type="text/css" href="{{=URL('static','css/tskasia.css')}}" />
       <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
       <script type="text/javascript">

    $(document).ready(function(){
        )} 



</script>
</head>


<body class="home">

<div id="container">
<header>

    <img src="{{=URL('static','images/header.png')}}" id="header" />


</header>

<nav>

<ul class="navigation">
    <li><a class="home" href="index.html">Home</a></li>
    <li><a class="about" href="about.html">About</a></li>
    <li><a class="product" href="products.html">Products</a></li>
    <li><a class="contact" href="contact.html">Contact</a></li>
    <li><a class="bookings" href="bookings.html">Bookings</a></li>
     <li><a class ="User" href="user1/profile">{{if auth.user:}}Account{{pass}}</a></li>

     {{if not auth.user:}}
     <li> <a href="#" id="pop" onclick="$('#overlay_form').load('/tskasiav3/default/user1');">Login</a></li>
    {{pass}}
    {{if auth.user:}}
    <li><a class ="Logout" href="user1/logout" id="Logout">Logout</a></li>
    {{pass}}


</ul>

</nav>

</doctype>

其要点是使用弹出式登录表单让用户输入他们的详细信息

索引页中不存在您的“…”,因为jQuery将返回空引用,而不会发生任何事情。嘿,谢谢。我已经复制了div,但是现在我得到的'NoneType'对象没有属性'replace',这是因为代码{{=T request.args0.replace''.''.'.capitalize}}如果我删除它,登录框会工作,但不会提交值。