Javascript 模式窗体的按钮不显示或不起作用

Javascript 模式窗体的按钮不显示或不起作用,javascript,php,html,forms,Javascript,Php,Html,Forms,我已经在这里讨论了一个类似的问题,但是在我的代码中移动了这个交互,并且有相同的问题。。。但我相信有一个不同的原因 我的页面底部有一个“给我发电子邮件”按钮: 当你点击“电子邮件我”按钮时,应该出现一个覆盖,中间有一个电子邮件表单。我让它在一个测试页面上工作,然后将所有项目移到我的index.html,但它不工作 我现在的目标就是让覆盖图和表单在页面中弹出 我检查了我的路径,以确保它们是正确的,我认为它们是正确的,但我不知道如何使用Google的emulator解析或检查php,以查看哪些地方可

我已经在这里讨论了一个类似的问题,但是在我的代码中移动了这个交互,并且有相同的问题。。。但我相信有一个不同的原因

我的页面底部有一个“给我发电子邮件”按钮:

当你点击“电子邮件我”按钮时,应该出现一个覆盖,中间有一个电子邮件表单。我让它在一个测试页面上工作,然后将所有项目移到我的index.html,但它不工作

我现在的目标就是让覆盖图和表单在页面中弹出

我检查了我的路径,以确保它们是正确的,我认为它们是正确的,但我不知道如何使用Google的emulator解析或检查php,以查看哪些地方可能不起作用

我检查了指向css的index.html头链接,index.html末尾的javascript,然后在contact.js中,有一个指向php文件的GET链接

另外,在HTML中,我不确定如何在该按钮上“调用”(?)php或jquery,以及这是否是问题所在。它以前是按原样工作的,我假设class=“contact”是所有这些工作的原因?我不知道。我想知道类是如何触发javascript文件的

我之前也因为没有PHP而被骂了一顿,但直到今天我才知道这是无法查看的,所以我将把它放在下面。我不确定这是否有用

jQuery(function ($) {
 var contact = {
    message: null,
    init: function () {
        $('#contact-form input.contact, #contact-form a.contact').click(function (e) {
            e.preventDefault();

            // load the contact form using ajax
            $.get("contact/data/contact.php", function(data){
                // create a modal dialog with the data
                $(data).modal({
                    closeHTML: "<a href='#' title='Close' class='modal-close'>x</a>",
                    position: ["15%",],
                    overlayId: 'contact-overlay',
                    containerId: 'contact-container',
                    onOpen: contact.open,
                    onShow: contact.show,
                    onClose: contact.close
                });
            });
        });
    },
    open: function (dialog) {
        // dynamically determine height
        var h = 280;
        if ($('#contact-subject').length) {
            h += 26;
        }
        if ($('#contact-cc').length) {
            h += 22;
        }

        var title = $('#contact-container .contact-title').html();
        $('#contact-container .contact-title').html('Loading...');
        dialog.overlay.fadeIn(200, function () {
            dialog.container.fadeIn(200, function () {
                dialog.data.fadeIn(200, function () {
                    $('#contact-container .contact-content').animate({
                        height: h
                    }, function () {
                        $('#contact-container .contact-title').html(title);
                        $('#contact-container form').fadeIn(200, function () {
                            $('#contact-container #contact-name').focus();

                            $('#contact-container .contact-cc').click(function () {
                                var cc = $('#contact-container #contact-cc');
                                cc.is(':checked') ? cc.attr('checked', '') : cc.attr('checked', 'checked');
                            });
                        });
                    });
                });
            });
        });
    },
    show: function (dialog) {
        $('#contact-container .contact-send').click(function (e) {
            e.preventDefault();
            // validate form
            if (contact.validate()) {
                var msg = $('#contact-container .contact-message');
                msg.fadeOut(function () {
                    msg.removeClass('contact-error').empty();
                });
                $('#contact-container .contact-title').html('Sending...');
                $('#contact-container form').fadeOut(200);
                $('#contact-container .contact-content').animate({
                    height: '80px'
                }, function () {
                    $('#contact-container .contact-loading').fadeIn(200, function () {
                        $.ajax({
                            url: '/contact/data/contact.php',
                            data: $('#contact-container form').serialize() + '&action=send',
                            type: 'post',
                            cache: false,
                            dataType: 'html',
                            success: function (data) {
                                $('#contact-container .contact-loading').fadeOut(200, function () {
                                    $('#contact-container .contact-title').html('Thank you!');
                                    msg.html(data).fadeIn(200);
                                });
                            },
                            error: contact.error
                        });
                    });
                });
            }
            else {
                if ($('#contact-container .contact-message:visible').length > 0) {
                    var msg = $('#contact-container .contact-message div');
                    msg.fadeOut(200, function () {
                        msg.empty();
                        contact.showError();
                        msg.fadeIn(200);
                    });
                }
                else {
                    $('#contact-container .contact-message').animate({
                        height: '30px'
                    }, contact.showError);
                }

            }
        });
    },
    close: function (dialog) {
        $('#contact-container .contact-message').fadeOut();
        $('#contact-container .contact-title').html('Goodbye...');
        $('#contact-container form').fadeOut(200);
        $('#contact-container .contact-content').animate({
            height: 40
        }, function () {
            dialog.data.fadeOut(200, function () {
                dialog.container.fadeOut(200, function () {
                    dialog.overlay.fadeOut(200, function () {
                        $.modal.close();
                    });
                });
            });
        });
    },
    error: function (xhr) {
        alert(xhr.statusText);
    },
    validate: function () {
        contact.message = '';
        if (!$('#contact-container #contact-name').val()) {
            contact.message += 'Name is required. ';
        }

        var email = $('#contact-container #contact-email').val();
        if (!email) {
            contact.message += 'Email is required. ';
        }
        else {
            if (!contact.validateEmail(email)) {
                contact.message += 'Email is invalid. ';
            }
        }

        if (!$('#contact-container #contact-message').val()) {
            contact.message += 'Message is required.';
        }

        if (contact.message.length > 0) {
            return false;
        }
        else {
            return true;
        }
    },
    validateEmail: function (email) {
        var at = email.lastIndexOf("@");

        // Make sure the at (@) sybmol exists and  
        // it is not the first or last character
        if (at < 1 || (at + 1) === email.length)
            return false;

        // Make sure there aren't multiple periods together
        if (/(\.{2,})/.test(email))
            return false;

        // Break up the local and domain portions
        var local = email.substring(0, at);
        var domain = email.substring(at + 1);

        // Check lengths
        if (local.length < 1 || local.length > 64 || domain.length < 4 || domain.length > 255)
            return false;

        // Make sure local and domain don't start with or end with a period
        if (/(^\.|\.$)/.test(local) || /(^\.|\.$)/.test(domain))
            return false;

        // Check for quoted-string addresses
        // Since almost anything is allowed in a quoted-string address,
        // we're just going to let them go through
        if (!/^"(.+)"$/.test(local)) {
            // It's a dot-string address...check for valid characters
            if (!/^[-a-zA-Z0-9!#$%*\/?|^{}`~&'+=_\.]*$/.test(local))
                return false;
        }

        // Make sure domain contains only valid characters and at least one period
        if (!/^[-a-zA-Z0-9\.]*$/.test(domain) || domain.indexOf(".") === -1)
            return false;   

        return true;
    },
    showError: function () {
        $('#contact-container .contact-message')
            .html($('<div class="contact-error"></div>').append(contact.message))
            .fadeIn(200);
    }
};

contact.init();

  });
jQuery(函数($){
var触点={
消息:空,
init:函数(){
$(“#联系人表单input.contact,#联系人表单a.contact”)。单击(函数(e){
e、 预防默认值();
//使用ajax加载联系人表单
$.get(“contact/data/contact.php”,函数(数据){
//使用数据创建一个模态对话框
$(数据)({
关闭HTML:“”,
职位:[“15%”,],
覆盖ID:“联系人覆盖”,
containerId:“联系集装箱”,
onOpen:contact.open,
onShow:contact.show,
onClose:contact.close
});
});
});
},
打开:函数(对话框){
//动态确定高度
var h=280;
如果($(“#联系对象”)。长度){
h+=26;
}
如果($('#联系cc')。长度){
h+=22;
}
var title=$('#contact container.contact title').html();
$('#contact container.contact title').html('Loading…');
dialog.overlay.fadeIn(200,函数(){
dialog.container.fadeIn(200,函数(){
dialog.data.fadeIn(200,函数(){
$('#contact container.contact content')。动画({
身高:h
},函数(){
$('#contact container.contact title').html(title);
$(“#联系人容器表单”).fadeIn(200,函数(){
$(“#联系人容器#联系人名称”).focus();
$('#contact container.contact cc')。单击(函数(){
var cc=$(“#联系容器#联系cc”);
抄送是(':checked')?抄送属性('checked',''):抄送属性('checked','checked');
});
});
});
});
});
});
},
显示:函数(对话框){
$('#contact container.contact send')。单击(函数(e){
e、 预防默认值();
//验证表单
if(contact.validate()){
var msg=$(“#contact container.contact message”);
msg.fadeOut(函数(){
msg.removeClass('contact-error').empty();
});
$('#contact container.contact title').html('Sending…');
$(“#接触容器形式”).fadeOut(200);
$('#contact container.contact content')。动画({
高度:'80px'
},函数(){
$('#contact container.contact loading').fadeIn(200,函数(){
$.ajax({
url:“/contact/data/contact.php”,
数据:$(“#联系人容器表单”).serialize()+”&action=send',
键入:“post”,
cache:false,
数据类型:“html”,
成功:功能(数据){
$('#contact container.contact loading').fadeOut(200,函数(){
$('#contact container.contact title').html('谢谢!');
msg.html(数据).fadeIn(200);
});
},
错误:contact.error
});
});
});
}
否则{
if($('#联系人容器。联系人消息:可见')。长度>0){
var msg=$('#contact container.contact message div');
味精淡出(200,功能(){
msg.empty();
contact.bathror();
味精法代因(200);
});
}
否则{
$('#contact container.contact message')。动画({
高度:“30px”
},联络人(ROR);
}
}
});
},
关闭:函数(对话框){
$('#contact container.contact message').fadeOut();
$('#contact container.contact title').html('再见…');
$(“#接触容器形式”).fadeOut(200);
$('#contact container.contact content')。动画({
身高:40
},函数(){
//1) run the currently selected effect
function runEffect() {

//2) Hide the button`
  $( "#eMailButton" ).fadeOut();  


  //3) Show the email form
  $( "#effect" ).show( selectedEffect, options, 500, callback );

  //4) Hide the email form and show the button again ( 4 seconds later in this demo...)
  // other effects and actions can be coded when the user submits his/her info..)
  function callback() {
    setTimeout(function() {
      $( "#effect:visible" ).removeAttr( "style" ).fadeOut();
      $( "#eMailButton" ).fadeIn();
    }, 4000 );
  };