关闭jQuery Popup

时间:2013-03-18 17:53:41

标签: javascript jquery html

我有一个Site是使用codelifter.com的一些脚本构建的,它是一个非常古老的网站,我需要进行一点编辑。我没有创建网站我只是想知道为什么JavaScript弹出窗口不会关闭。如果您点击CA即可快速到达,但如果您点击TX,则会打开一个不会关闭的弹出窗口。

我的问题是我需要更改哪些代码才能关闭它?

以下代码存在问题吗?

由于

var strGoToUrl = "";

        function ShowPopup(strUrl) {
            var str = '<table cellspacing="1" cellpadding="2" style="background:black"><tr>';
            str += '<td style="background:#ffeccc" width="460">';
            str += '<table cellspacing="0" cellpadding="2" width="100%"><tr>';
            str += '<td align="right"><a href="javascript:HidePopup();">Close</a></td>';
            str += '</tr><tr>';
            str += '<td align="center">';
            str += 'TODAY- ASA members can get medical insurance quotes and buy quality, affordable ';
            str += 'medical insurance group plans through Benefit Consultants Northwest (BCNW).<br/><br/>';
            str += '<a href=\"' + strUrl + '\">Click here for Quotes, Medical plan information and plan selections.</a><br/>';
            str += '<a href=\"' + strUrl + '\"><img src="images/bcnw_logo3.gif" width="186" height="60" border="0" /></a><br/>';
            str += 'Automotive Industry Health Insurance Trust (A-HIT) association medical plans ';
            str += 'are not currently available in this state.<br/><br/>';
            str += '</td></tr></table></td></tr></table>';

            strGoToUrl = strUrl;
            alert(strGoToUrl);

            if (document.getElementById) {
                var elem = document.getElementById("popupDiv");
                elem.innerHTML = str;
                elem.style.display = "block";
                ShowRectangularDynamicDropShadow(elem, "#333333", 5);
            }
        }

        function GoToUrl() {
            alert(strGoToUrl);
            window.location = strGoToUrl;
        }

        function HidePopup() {
            if (document.getElementById) {
                var elem = document.getElementById("popupDiv");
                HideRectangularDynamicDropShadow(elem);
                elem.style.display = "none";
                elem.innerhtml = "";
            }
        }

1 个答案:

答案 0 :(得分:0)

试试这个...未经测试但应该有效......

<div id="popupDiv">

//Rest of the code

<div id="shadow"></div>
</div>

function ShowPopup(strUrl) {
        //rest of the code
          shadowDiv = document.getElementById("shadow").style.display = 'block';
          ShowRectangularDynamicDropShadow(shadowDiv, "#333333", 5);
        //rest of the code
}

   function HidePopup() {
        if (document.getElementById) {
            var elem = document.getElementById("popupDiv");
            shadowDiv = document.getElementById("shadow");
            HideRectangularDynamicDropShadow(shadowDiv);
            elem.style.display = "none";
            shadowDiv.style.display = "none";
            elem.innerhtml = "";
        }
    }