禁用Javascript按钮

时间:2012-11-12 07:18:17

标签: javascript

以下代码用于在我的网站上购买套餐。有关我的问题的示例,请转到http://www.gldesert.com/donate/packages/ranks/?checkbox1=on&checkbox2=on&checkbox3=on&submit=PROCEED+%3AD。单击“添加到购物车”按钮时,它会打开Buycraft的弹出窗口,这是一个Minecraft购物车。但是,如果您将另一个项目添加到购物车,它会关闭弹出窗口。我该如何保持开放状态?

<!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>

2 个答案:

答案 0 :(得分:1)

我的朋友,你应该从根本上减少你的javascript堆栈。 首先,从font-face开始,而不是cufon。 然后,使用更新版本的jquery。 然后,看看会发生什么。

你的脚本太多了。可能会出现错误和冲突。 此外,我注意到您在代码中使用“getElementById”。 你的页面中有jquery。 使用它。

答案 1 :(得分:0)

即使你保持启用它,整个系统也会以这种方式运行,它会给你一个错误:

  

这个包已经存在于篮子里。

用户应该有一个选项,可以在他/她结帐时更改项目数。我相信如果您仍然想要启用“按钮”,您还需要调整服务器端脚本,因为它会返回错误...