0

所以我有一个模式,当单击 UI 图标时会打开,并且由于某种原因,模式不会在 IE 以外的任何浏览器中关闭。有没有更简单的方法来做到这一点?或者我可以添加任何浏览器规范?

这是我的代码:

<!-- Click function for modal -->
$(ui).click(function modal() {
    el = document.getElementById("modal");
    el.style.visibility = (el.style.visibility == "visible")?"hidden":"visible";
});


<div id="modal" class="modal" draggable="true">
<div>
<h3 style="text-decoration: underline"> Summary Report Table </h3>
    <table id="summary">
        <tr>
            <th> Trans Count </th>
            <th> Trans Amt </th>
            <th> Match Count </th>
        </tr>
        <tr>
            <td> 300 </td>
            <td> $200,000 </td>
            <td> 4 </td>
        </tr>
    </table>
    <a href='#' onClick='modal()'>Close</a>
</div>

不知道为什么,但它不会让我缩进或返回我的代码。为可读性差表示歉意。

4

1 回答 1

0

您可以尝试以下方法(假设您使用的是 jquery):

$(ui).click(function () {
    $("#modal").toggle();
});

当您单击“ui”按钮时,上面的代码将切换模式(如果它隐藏则显示它,或者如果它已经可见则隐藏它)

于 2013-11-08T20:13:46.513 回答