2013-03-18 114 views
0

我有一個Site,它是用codelifter.com的一些腳本構建的,它是一個非常舊的站點,我需要做一點編輯。我沒有創建網站,我只是想知道爲什麼JavaScript彈出不會關閉。如果你點擊CA,你會很快到來,但如果你點擊TX,它會打開一個不會關閉的彈出窗口。關閉jQuery Popup

我的問題是我需要更改哪一行代碼才能關閉?

下面的代碼是否存在問題?

感謝

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 = ""; 
      } 
     } 
+0

該網站的工作只是罰款的Firefox。你在哪些瀏覽器中看到這種行爲?另外,你有沒有做過任何調試,看看你是否得到錯誤?我的猜測是你沒有。在maploacation.aspx的第256行出現錯誤:document.Show.MouseX.value = tempX; – 2013-03-18 17:59:30

+2

我在Chrome中觀察過。在控制檯中可以觀察到一堆錯誤。所以,你需要先糾正那些要執行的函數。 (快速入侵)不要嘗試使顯示無效,請嘗試刪除該節點。 – theshadowmonkey 2013-03-18 18:04:54

回答

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 = ""; 
     } 
    }