Javascript 链接到Fancybox覆盖中的内容会产生错误,不会';t链接

Javascript 链接到Fancybox覆盖中的内容会产生错误,不会';t链接,javascript,hyperlink,fancybox,Javascript,Hyperlink,Fancybox,我们有这个Fancybox覆盖层,用于一个旧的遗留站点上的登录表单。我没有建立这个网站,但我正在努力理解它。我添加了一个链接到新的“注册”页面,人们可以在那里注册(在代码的底部) 我已经检查了这个网站上的一些其他线程,它们似乎应该与此相关,但我还没有能够通过使用它们来解决我的问题。只是想让你们都知道,我至少在发帖前搜索过 到目前为止,我已经尝试: 简易锚链 带有javascript重定向、位置等的锚点 似乎什么都不管用。我总是会遇到这样的错误: 无法加载请求的内容。请稍后再试 我被这个弄糊涂

我们有这个Fancybox覆盖层,用于一个旧的遗留站点上的登录表单。我没有建立这个网站,但我正在努力理解它。我添加了一个链接到新的“注册”页面,人们可以在那里注册(在代码的底部)

我已经检查了这个网站上的一些其他线程,它们似乎应该与此相关,但我还没有能够通过使用它们来解决我的问题。只是想让你们都知道,我至少在发帖前搜索过

到目前为止,我已经尝试:

  • 简易锚链
  • 带有javascript重定向、位置等的锚点
似乎什么都不管用。我总是会遇到这样的错误:

无法加载请求的内容。请稍后再试

我被这个弄糊涂了。这么简单的事情(链接到另一个页面)应该不会这么困难

调用模态的标记:

<a style="float:right;<?= preg_match("/MSIE 7/",$_SERVER['HTTP_USER_AGENT']) ? 'width:135px;' : '' ?>position:relative;top:-3px;left:8px;" href="#login" class="button modal"><span class="begin"></span>Client Login<span class="end"></span></a>
<div id="login" class="modal">

    <form id="login" method="post" action="http://myposturl/">

        <h3>Enter your user name and password to login:</h3>

        <fieldset class="fields">

            <p><label for="username">Username:</label> <span class="field"><input type="text" id="username" name="username" tabindex="1" class="required" /></span></p>

            <p><label for="password">Password:</label> <span class="field"><input type="password" id="password" name="password" tabindex="2" class="required" /></span></p>

            <div class="clear"></div>

            <p><a class="button" href="#submit" onclick="document.forms['login'].submit();" onkeypress="document.forms['login'].submit();" title="Login"><span class="begin"></span>Login<span class="end"></span></a>

                <a href="javascript:;" class="button" onclick="$.fancybox.close();"><span class="begin"></span>Cancel<span class="end"></span></a></p>

        </fieldset>

    </form>

    <p><a href="http://myregistrationurl/">New User? Register here!</a></p>

</div>
<script type="text/javascript">
    $(document).ready(function() {
        $("a[href*=http://]:not('.facebook_link'),a[href*=https://]:not('.facebook_link')").fancybox({
            'transitionIn' : 'fade', 
            'transitionOut' : 'fade', 
            'height' : '100%', 
            'width' : 900, 
            'speedIn' : 300, 
            'speedOut' : 0, 
            'overlayColor' : '#000'
        });         
        $('a.modal').fancybox({
            'transitionIn' : 'fade', 
            'transitionOut' : 'fade', 
            'speedIn' : 300, 
            'speedOut' : 0, 
            'overlayColor' : '#000',
            'titleShow' : false
        });
        $('.cycle').cycle({
            fx: 'fade',
            pause: true
        });
    });
</script>

模态的标记:

<a style="float:right;<?= preg_match("/MSIE 7/",$_SERVER['HTTP_USER_AGENT']) ? 'width:135px;' : '' ?>position:relative;top:-3px;left:8px;" href="#login" class="button modal"><span class="begin"></span>Client Login<span class="end"></span></a>
<div id="login" class="modal">

    <form id="login" method="post" action="http://myposturl/">

        <h3>Enter your user name and password to login:</h3>

        <fieldset class="fields">

            <p><label for="username">Username:</label> <span class="field"><input type="text" id="username" name="username" tabindex="1" class="required" /></span></p>

            <p><label for="password">Password:</label> <span class="field"><input type="password" id="password" name="password" tabindex="2" class="required" /></span></p>

            <div class="clear"></div>

            <p><a class="button" href="#submit" onclick="document.forms['login'].submit();" onkeypress="document.forms['login'].submit();" title="Login"><span class="begin"></span>Login<span class="end"></span></a>

                <a href="javascript:;" class="button" onclick="$.fancybox.close();"><span class="begin"></span>Cancel<span class="end"></span></a></p>

        </fieldset>

    </form>

    <p><a href="http://myregistrationurl/">New User? Register here!</a></p>

</div>
<script type="text/javascript">
    $(document).ready(function() {
        $("a[href*=http://]:not('.facebook_link'),a[href*=https://]:not('.facebook_link')").fancybox({
            'transitionIn' : 'fade', 
            'transitionOut' : 'fade', 
            'height' : '100%', 
            'width' : 900, 
            'speedIn' : 300, 
            'speedOut' : 0, 
            'overlayColor' : '#000'
        });         
        $('a.modal').fancybox({
            'transitionIn' : 'fade', 
            'transitionOut' : 'fade', 
            'speedIn' : 300, 
            'speedOut' : 0, 
            'overlayColor' : '#000',
            'titleShow' : false
        });
        $('.cycle').cycle({
            fx: 'fade',
            pause: true
        });
    });
</script>

输入要登录的用户名和密码:
用户名:

密码:

下面是实际调用Fancybox的代码:

<a style="float:right;<?= preg_match("/MSIE 7/",$_SERVER['HTTP_USER_AGENT']) ? 'width:135px;' : '' ?>position:relative;top:-3px;left:8px;" href="#login" class="button modal"><span class="begin"></span>Client Login<span class="end"></span></a>
<div id="login" class="modal">

    <form id="login" method="post" action="http://myposturl/">

        <h3>Enter your user name and password to login:</h3>

        <fieldset class="fields">

            <p><label for="username">Username:</label> <span class="field"><input type="text" id="username" name="username" tabindex="1" class="required" /></span></p>

            <p><label for="password">Password:</label> <span class="field"><input type="password" id="password" name="password" tabindex="2" class="required" /></span></p>

            <div class="clear"></div>

            <p><a class="button" href="#submit" onclick="document.forms['login'].submit();" onkeypress="document.forms['login'].submit();" title="Login"><span class="begin"></span>Login<span class="end"></span></a>

                <a href="javascript:;" class="button" onclick="$.fancybox.close();"><span class="begin"></span>Cancel<span class="end"></span></a></p>

        </fieldset>

    </form>

    <p><a href="http://myregistrationurl/">New User? Register here!</a></p>

</div>
<script type="text/javascript">
    $(document).ready(function() {
        $("a[href*=http://]:not('.facebook_link'),a[href*=https://]:not('.facebook_link')").fancybox({
            'transitionIn' : 'fade', 
            'transitionOut' : 'fade', 
            'height' : '100%', 
            'width' : 900, 
            'speedIn' : 300, 
            'speedOut' : 0, 
            'overlayColor' : '#000'
        });         
        $('a.modal').fancybox({
            'transitionIn' : 'fade', 
            'transitionOut' : 'fade', 
            'speedIn' : 300, 
            'speedOut' : 0, 
            'overlayColor' : '#000',
            'titleShow' : false
        });
        $('.cycle').cycle({
            fx: 'fade',
            pause: true
        });
    });
</script>

$(文档).ready(函数(){
$(“a[href*=http://]:not('.facebook_-link'),a[href*=https://]:not('.facebook_-link')))。fancybox({
“transitionIn”:“fade”,
“transitionOut”:“fade”,
“高度”:“100%”,
“宽度”:900,
“speedIn”:300,
“速度输出”:0,
“套色”:“000”
});         
$('a.modal').fancybox({
“transitionIn”:“fade”,
“transitionOut”:“fade”,
“speedIn”:300,
“速度输出”:0,
“套色”:“000”,
“标题秀”:错误
});
$('.cycle').cycle({
外汇:“淡出”,
停顿:是的
});
});

能否显示调用fancybox的脚本?你正在使用iframe设置吗?刚刚用新信息编辑了文章。谢谢这有用吗?除非我误读了另一篇文章,否则可能不会。问题在于你在上面看到的一切,那就是覆盖层本身。该链接位于覆盖层内,该链接应转到完全独立的页面。现在,fancybox正试图将其视为一个新的覆盖链接或其他东西。我肯定更喜欢后端/数据库,所以说实话,这有点超出了我的舒适区。希望有容易修复的东西!类
modal
应该分配给触发fancybox的元素(在大多数情况下是一个链接),而不是分配给您使用此类链接瞄准的元素。。。您还将类
modal
添加到此
中,因此您可能会在fancybox中的每个操作都进入一个循环。