IE9中的简单模态问题 [英] Problems with simple modal in IE9

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

问题描述

昨天我启动了一个新网站.在将文件上传到服务器之前,我已经在IE8,Firefox,Safari和Chrome中测试了该网站,并且一切正常.但是我只是安装了IE9,并且我的简单模态框未在此浏览器中显示./p>

我正在使用以下javascript代码:

jQuery(function ($) {
    $('a.modal').click(function (e) {
        $('#' + this.id + "content").modal({onOpen: function (dialog) {
            dialog.overlay.fadeIn('fast', function () {
                dialog.container.fadeIn('fast');
                dialog.data.fadeIn('slow');
            });
        }});
        return false;
    });
    $.modal.defaults.onClose = function (dialog) {
        dialog.data.fadeOut('fast', function () {
            dialog.container.hide('fast', function () {
                dialog.overlay.fadeOut('fast', function () {
                    $.modal.close();
                });
            });
        });
    };
});

其中一个框的HTML代码:

<div id="registercontent">
    <div id="registerresult" style="display: none;"></div>
    <form class="ajaxform" id="register" name="register" method="post" action="register.php">
    <table>
        <tr>
          <td>Username: </td>
          <td><input type="text" name="username" value="" /></td>
        </tr>
        <tr>  
          <td>Password: </td>
          <td><input type="password" name="password" value="" /></td>
        </tr>
        <tr>
          <td>Confirm password: </td>
          <td><input type="password" name="password2" value="" /></td>
        </tr>
        <tr>
          <td>Email address: </td>
          <td><input type="text" name="email" value="" /></td>
        </tr>
        <tr>
          <td></td>
          <td><input type="submit" value="Register!" class="button" /></td>
        </tr>
    </table>
    </form>
</div>

如果您需要查看更多代码,请访问以下网站: Mixious (例如,联系并注册右上角的菜单必须打开一个模式框)

有人知道如何解决这个问题吗?

解决方案

在IE9(F12)中打开开发人员工具,然后打开控制台"选项卡.您会看到一个错误记录.关于getElementsByTagName的一些事情未在某些对象上定义.

请参阅我对您的原始问题的评论.较新的jQuery版本可能会出现问题.

似乎已在1.5.1中修复,但我不确定,我正在正确阅读: http ://bugs.jquery.com/ticket/8052

Yesterday I launched a new website. Before I uploaded the files to my server, I tested the website in IE8, Firefox, Safari and Chrome, and everything seemed to be OK. But I just installed IE9 and my Simple Modal boxes don't show up in this browser.

I'm using the following javascript code:

jQuery(function ($) {
    $('a.modal').click(function (e) {
        $('#' + this.id + "content").modal({onOpen: function (dialog) {
            dialog.overlay.fadeIn('fast', function () {
                dialog.container.fadeIn('fast');
                dialog.data.fadeIn('slow');
            });
        }});
        return false;
    });
    $.modal.defaults.onClose = function (dialog) {
        dialog.data.fadeOut('fast', function () {
            dialog.container.hide('fast', function () {
                dialog.overlay.fadeOut('fast', function () {
                    $.modal.close();
                });
            });
        });
    };
});

The HTML code of one of the boxes:

<div id="registercontent">
    <div id="registerresult" style="display: none;"></div>
    <form class="ajaxform" id="register" name="register" method="post" action="register.php">
    <table>
        <tr>
          <td>Username: </td>
          <td><input type="text" name="username" value="" /></td>
        </tr>
        <tr>  
          <td>Password: </td>
          <td><input type="password" name="password" value="" /></td>
        </tr>
        <tr>
          <td>Confirm password: </td>
          <td><input type="password" name="password2" value="" /></td>
        </tr>
        <tr>
          <td>Email address: </td>
          <td><input type="text" name="email" value="" /></td>
        </tr>
        <tr>
          <td></td>
          <td><input type="submit" value="Register!" class="button" /></td>
        </tr>
    </table>
    </form>
</div>

If you need to see more code, please visit the website: Mixious (for example contact and register in the right top menu have to open a modal box)

Does anybody have an idea how to solve this problem?

解决方案

Open the developer tools in IE9 (F12) and open the Console tab. You'll see an error being logged. Something about getElementsByTagName not defined on some object.

See my comment on your original question. Might be a problem with the more recent jQuery versions.

Seems to be fixed in 1.5.1, though I am not sure, I am reading that correctly: http://bugs.jquery.com/ticket/8052

这篇关于IE9中的简单模态问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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