2012-11-12 111 views
0

提供的以下代碼用於在我的網站上購買軟件包。有關我的問題的示例,請轉至http://www.gldesert.com/donate/packages/ranks/?checkbox1=on&checkbox2=on&checkbox3=on&submit=PROCEED+%3AD。點擊添加到購物車按鈕後,它會打開Minecraft購物車Buycraft的彈出窗口。但是,如果您將另一項物品添加到購物車,則會關閉彈出窗口。我如何保持開放?禁用Javascript按鈕

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> 
<html><head> 
<html class="no-js" lang="pt-BR" dir="ltr" xml:lang="pt-BR"> 
<meta name="google" value="notranslate">  
    <link rel="stylesheet" href="/css/reset.css" type="text/css" media="screen"> 
    <link rel="stylesheet" href="/css/ranksstyle.css" type="text/css" media="screen"> 
    <link rel="stylesheet" href="/css/grid.css" type="text/css" media="screen">  
    <script src="/js/jquery-1.6.2.min.js" type="text/javascript"></script> 
    <script src="/js/jquery.easing.1.3.js" type="text/javascript"></script> 
    <script src="/js/tms-0.3.js" type="text/javascript"></script> 
    <script src="/js/tms_presets.js" type="text/javascript"></script> 
    <script src="/js/cufon-yui.js" type="text/javascript"></script> 
    <script src="/js/cufon-replace.js" type="text/javascript"></script> 
    <script src="/js/FF-cache.js" type="text/javascript"></script> 
    <script src="/js/Kozuka_Gothic_Pro_OpenType_700.font.js" type="text/javascript"></script>   
    <script src="/js/Kozuka_Gothic_Pro_OpenType_500.font.js" type="text/javascript"></script>    
    <script src="/js/tabs.js" type="text/javascript"></script>  
    <script src="/js/superfish.js" type="text/javascript"></script>   
    <script src="/js/jquery.mousewheel.js" type="text/javascript"></script>    
    <script src="/js/jScrollPane.js" type="text/javascript"></script>   
    <script src="/js/script.js" type="text/javascript"></script> 
    <script src="/js/jquery.iframe.js"></script> 
    <script src="/js/jquery.collapse.js"></script> 

<style type="text/css"> 
.menutitle{ 
cursor:pointer; 
margin-bottom: 5px; 
background-color:#ECECFF; 
color:#000000; 
width:140px; 
padding:2px; 
text-align:center; 
font-weight:bold; 
/*/*/border:1px solid #000000;/* */ 
} 

.submenu{ 
margin-bottom: 0.5em; 
} 
</style> 
<script type="text/javascript"> 

    var _gaq = _gaq || []; 
    _gaq.push(['_setAccount', 'UA-30249399-1']); 
    _gaq.push(['_trackPageview']); 

    (function() { 
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; 
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; 
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); 
    })(); 

</script> 
<script type="text/javascript"> 

    var _gaq = _gaq || []; 
    _gaq.push(['_setAccount', 'UA-30249399-2']); 
    _gaq.push(['_trackPageview']); 

    (function() { 
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; 
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; 
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); 
    })(); 

</script> 
<script type="text/javascript"> 

var persistmenu="no" //"yes" or "no". Make sure each SPAN content contains an incrementing ID starting at 1 (id="sub1", id="sub2", etc) 
var persisttype="sitewide" //enter "sitewide" for menu to persist across site, "local" for this page only 

if (document.getElementById){ //DynamicDrive.com change 
document.write('<style type="text/css">\n') 
document.write('.submenu{display: none;}\n') 
document.write('</style>\n') 
} 

function SwitchMenu(obj){ 
if(document.getElementById){ 
var el = document.getElementById(obj); 
var ar = document.getElementById("masterdiv").getElementsByTagName("span"); //DynamicDrive.com change 
if(el.style.display != "block"){ //DynamicDrive.com change 
for (var i=0; i<ar.length; i++){ 
if (ar[i].className=="submenu") //DynamicDrive.com change 
ar[i].style.display = "none"; 
} 
el.style.display = "block"; 
}else{ 
el.style.display = "none"; 
} 
} 
} 

function get_cookie(Name) { 
var search = Name + "=" 
var returnvalue = ""; 
if (document.cookie.length > 0) { 
offset = document.cookie.indexOf(search) 
if (offset != -1) { 
offset += search.length 
end = document.cookie.indexOf(";", offset); 
if (end == -1) end = document.cookie.length; 
returnvalue=unescape(document.cookie.substring(offset, end)) 
} 
} 
return returnvalue; 
} 

function onloadfunction(){ 
if (persistmenu=="yes"){ 
var cookiename=(persisttype=="sitewide")? "switchmenu" : window.location.pathname 
var cookievalue=get_cookie(cookiename) 
if (cookievalue!="") 
document.getElementById(cookievalue).style.display="block" 
} 
} 

function savemenustate(){ 
var inc=1, blockid="" 
while (document.getElementById("sub"+inc)){ 
if (document.getElementById("sub"+inc).style.display=="block"){ 
blockid="sub"+inc 
break 
} 
inc++ 
} 
var cookiename=(persisttype=="sitewide")? "switchmenu" : window.location.pathname 
var cookievalue=(persisttype=="sitewide")? blockid+";path=/" : blockid 
document.cookie=cookiename+"="+cookievalue 
} 

if (window.addEventListener) 
window.addEventListener("load", onloadfunction, false) 
else if (window.attachEvent) 
window.attachEvent("onload", onloadfunction) 
else if (document.getElementById) 
window.onload=onloadfunction 

if (persistmenu=="yes" && document.getElementById) 
window.onunload=savemenustate 

</script> 
<body> 
<center> 
<div class="main"> 
    <header> 
     <div class="inner"> 
      <div class="container"> 
       <h1><a href="/">GLD</a></h1> 
       <ul class="login_panel"> 
        <li></li> 
        <li></li> 
       </ul> 
       <ul class="links"> 
       <img style="width: 360px; height: 75px;" src="http://cache.multiplayuk.com/b/1-218175-560x95-2173-FFD117-FFFFFF.png" alt="" /> 
       </ul> 
      </div> 
     </div>  <div class="menu_block"> 
      <div class="container"> 
       <nav> 
        <ul class="sf-menu"> 
         <li class="active"><a href="/donate">Donate</a> 
         <li><a href="/donate/packages/special">Special Packages!</a></li> 
         <li><a href="/donate/packages/upgrades">Rank Upgrades</a></li> 
         <li><a href="/donate/packages/mcmmo">McMMO Points</a></li> 
         <li><a href="/donate/packages/lightstones">Lightstones</a></li> 
    <p>&nbsp;</p> 
        </ul> 
        <div class="clear"></div> 
       </nav> 
      </div> 
     </div> 
</a> 
</b> 
</ul> 
<div id="main"></li> 
<center> 
<div id="main"></li> 
    <center> 
    <p>&nbsp;</p> 
    <p>&nbsp;</p> 
<div class="block small left" style="width:99%;">    
     <table cellpadding="0" cellspacing="0" width="99%"> 
<div id="masterdiv"> 

<div onclick="SwitchMenu('sub1')"></div> 
<span class="submenu" id="sub1"> 
<h2> 
<script> 
$("iframe").src(url, optionalCallback, options); $("iframe").squirt(html, optionalCallback, options); 
</script> 
<script> 
$("<iframe name='ajaxForm' />").src("http://gldesert.com/donate/transfer.php").attr('scrolling','no').width("1000").height("620").appendTo("h2"); 

$("iframe").src("http://gldesert.com/donate/transfer.php", function(iframe, duration) {; 
}, { 
    timeout: function() { alert("Oh no! The donation page is having an issue :(It will surely get fixed soon! Check back later and tell Joan!"); }, 
    timeoutDuration: 10000 
}); 
</script> 
</h2> 
      <tbody> 

         <tr> 
          <td style="text-align:left;"><strong>Sand Traveler</strong></td> 
          <td style="text-align:right;"><strong>4.99 USD</strong></td>    
          <td style="text-align:right;"> 
           <form method="POST" action="https://buycraft.net/redirect/addcart/2031/2511" target="ajaxForm"> 
            <input type="submit" value="Add to Cart" class="submit" class="menutitle" onclick="SwitchMenu('sub1')"> 
           </form> 
          </td> 
         </tr>         
         <tr> 
          <td style="text-align:left;"><strong><span style="color: #7FF07F;">VIP</span></strong></td> 
          <td style="text-align:right;"><strong>14.99 USD</strong></td>    
          <td style="text-align:right;"> 
           <form method="POST" action="https://buycraft.net/redirect/addcart/2031/2489" target="ajaxForm"> 
            <input type="submit" value="Add to Cart" class="submit" class="menutitle" onclick="SwitchMenu('sub1')"> 
           </form> 
          </td> 
         </tr>    
         <tr> 
          <td style="text-align:left;"><strong><span style="color: #00BF00;">Premium</span></strong></td> 
          <td style="text-align:right;"><strong>29.99 USD</strong></td>    
          <td style="text-align:right;"> 
           <form method="POST" action="https://buycraft.net/redirect/addcart/2031/2517" target="ajaxForm"> 
            <input type="submit" value="Add to Cart" class="submit" class="menutitle" onclick="SwitchMenu('sub1')"> 
           </form> 
          </td> 
         </tr>      
         <tr> 
          <td style="text-align:left;"><strong><span style="color: #5252FA;">Exiled</span></strong></td> 
          <td style="text-align:right;"><strong>39.99 USD</strong></td>    
          <td style="text-align:right;"> 
           <form method="POST" action="https://buycraft.net/redirect/addcart/2031/2520" target="ajaxForm"> 
            <input type="submit" value="Add to Cart" class="submit" class="menutitle" onclick="SwitchMenu('sub1')"> 
           </form> 
          </td> 
         </tr> 


         <tr> 
          <td style="text-align:left;"><strong><span style="color: #B500B5;">Captain [Most Popular!]</span></strong></td> 
          <td style="text-align:right;"><strong>69.99 USD</strong></td>    
          <td style="text-align:right;"> 
           <form method="POST" action="https://buycraft.net/redirect/addcart/2031/2521" target="ajaxForm"> 
            <input type="submit" value="Add to Cart" class="submit" class="menutitle" onclick="SwitchMenu('sub1')"> 
           </form> 
          </td> 
         </tr> 
         <tr> 
          <td style="text-align:left;"><strong><span style="color: #00AAAA;">Veteran! [NEW!]</span></strong></td> 
          <td style="text-align:right;"><strong>99.00 USD</strong></td>    
          <td style="text-align:right;"> 
           <form method="POST" action="https://buycraft.net/redirect/addcart/2031/70786" target="ajaxForm"> 
            <input type="submit" value="Add to Cart" class="submit" class="menutitle" onclick="SwitchMenu('sub1')"> 
           </form> 
          </td> 
         </tr> 
         <tr> 
          <td style="text-align:left;"><strong><span style="color: #E3C100;">1337</span></strong></td> 
          <td style="text-align:right;"><strong>133.70 USD</strong></td>    
          <td style="text-align:right;"> 
           <form method="POST" action="https://buycraft.net/redirect/addcart/2031/2522" target="ajaxForm"> 
            <input type="submit" value="Add to Cart" class="submit" class="menutitle" onclick="SwitchMenu('sub1')"> 
           </form> 
          </td> 
         </tr> 

         <tr> 
          <td style="text-align:left;"><strong><span style="color: #FF5757;">Desert Sage</span></strong></td> 
          <td style="text-align:right;"><strong>79.99! <del>159.99 USD</del></strong></td>    
sale       <td style="text-align:right;"> 
           <form method="POST" action="https://buycraft.net/redirect/addcart/2031/2524" target="ajaxForm"> 
            <input type="submit" value="Add to Cart" class="submit" class="menutitle" onclick="SwitchMenu('sub1')"> 
           </form> 
          </td> 
         </tr> 
         <tr> 
          <td style="text-align:left;"><strong><span style="color: #0000E3;">Dark King</span></strong></td> 
          <td style="text-align:right;"><strong>99.99! <del>199.99 USD</del></strong></td>    
          <td style="text-align:right;"> 
           <form method="POST" action="https://buycraft.net/redirect/addcart/2031/3100" target="ajaxForm"> 
            <input type="submit" value="Add to Cart" class="submit" class="menutitle" onclick="SwitchMenu('sub1')"> 
           </form> 
          </td> 
         </tr> 



</center> 
</body> 
     </li> 
     </ul> 
    </blockquote> 
    </div> 
<h3><p style="color:#FF0000">IMPORTANT!: Please Do NOT Use Internet Explorer! It will not work...! CHROME, FIREFOX, ETC WILL WORK!</p></h3> 
<h3><p style="color:#FF0000">IF YOU REALLY MUST, GO TO THIS PAGE:<a href="http://gldesert.buycraft.net/">CLICK HERE</a></p></h3> 
<h3><a><p style="color:#FF0000">50% OFF DESERT SAGE & DARK KING!</a></p></h3> 
<br> 

</span> 


</div> 
</html> 

回答

1

我的朋友,你應該從根本上減少你的JavaScript堆棧在這裏。 首先,從font-face而不是cufon開始。 然後,使用更新版本的jquery。 然後,看看會發生什麼。

你有太多的腳本在那裏。錯誤和衝突是可以預料的。 另外,我注意到你在代碼中使用了「getElementById」。 你的頁面中有jquery。 使用它。

+0

這不是我的代碼。這是一個朋友。我正在爲他重寫這些,組織等,但這是他的主要bug和idk如何解決它。 – Waayzii

+0

減少腳本的數量。這種複雜性幾乎總會引發一些衝突。 此外,如此多的請求從根本上減緩了您的頁面加載 –

+0

您會如何推薦我這麼做? – Waayzii

0

即使你把它使整個系統功能的方式,它會給你一個錯誤:

That package already exists in the basket.

應該有一個用戶更改項目一旦他的數/她進行一個選項結帳。我相信,如果你仍然想啓用「按鈕」,你將需要調整你的服務器端腳本,因爲它返回一個錯誤...