在模态框中打开页面 [英] Open page in modal box

查看:72
本文介绍了在模态框中打开页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果没有选中复选框,我有一个限制点击href链接的脚本。我想在模式框中打开editpr.php。问题是我不熟悉modalbox。有什么帮助吗?

I have a script that restrict the click on a href link if there;s no checkbox selected. I want the editpr.php open in modal box. The problem is I'm not familiar with modalbox. Any help?

<a class="button edit" style="cursor:pointer;" ><span><b>Edit Purchase Request</b></span></a>
<a class="button remove" style="cursor:pointer;" name="remove"><span><b>Remove Purchase Request</b></span></a> 

这是我的脚本

jQuery(function ($) {
    $('a.button.edit, a.button.remove').click(function () {
        if ($('input[name="checkbox[]"]:checked').length == 0) {
            return;
        }

        if (!confirm('Do you want to continue?')) {
            return
        }

        var frm = document.myform;
        if ($(this).hasClass('edit')) {
            frm.action = 'editpr.php';
        }
        if ($(this).hasClass('remove')) {}
        frm.submit();
    })
})


推荐答案

您无法使用纯javascript打开模式框中的页面,如alert()或confirm()。

You can't open a page in a modal box just with pure javascript, as "alert()" or "confirm()".

要做你想要的事情需要将你的'editpr.php'内容放在div中,并使用CSS进行模态化。

To do what you want you need to put your 'editpr.php' content inside a div, and make it modal with CSS.

实际上我们有很多库可以制作它很容易发生,我认为最常用的是: http://www.jacklmoore.com/colorbox/

Actually we have a lot of libraries that make it happen easily, I think that most used is: http://www.jacklmoore.com/colorbox/

在此示例页面上检查外部HTML(Ajax)和外部网页(Iframe),可能与您要执行的操作相同:< a href =http://www.jacklmoore.com/colorbox/example1/ =nofollow> http://www.jacklmoore.com/colorbox/example1/

Check the "Outside HTML (Ajax)" and "Outside Webpage (Iframe)" on this example page, probably is the same thing that you want to do: http://www.jacklmoore.com/colorbox/example1/

这篇关于在模态框中打开页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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