我有这个简单的JQ购物车,我想添加到我的网站,但它从来没有工作,所以我用购物车制作了一个sepreat html文件并在本地进行了测试,它完美无缺。我通过ftp将所有文件原样上传到我的websever,但它不起作用,
我花了几个小时寻找可能的错误,但没有运气,任何人都可以快速看看并告诉我它会是什么?
以下是索引
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js" type="text/javascript"></script>
<meta charset="utf-8">
<!-- CSS for this product-->
<link rel="stylesheet" type="text/css" href="lib/dc.core.1.1.0.min.css" />
<link rel="stylesheet" type="text/css" href="lib/dc.cart.css" />
<!-- CSS for this example only-->
<link rel="stylesheet" type="text/css" href="common/sample.common.css" />
<link rel="stylesheet" type="text/css" href="common/sample.product.css" />
<link rel="stylesheet" type="text/css" href="common/prettify.css" />
<!-- Javascript for this product-->
<script src="lib/dc.core.1.1.0.min.js" type="text/javascript"></script>
<script src="lib/dc.cart.free.min.js" type="text/javascript"></script>
<script src="lib/dc.cart.lang.js" type="text/javascript"></script>
<!-- CSS for this example only-->
<script src="common/prettify.js" type="text/javascript"></script>
<script type="text/javascript">
$(function() {
// Create a new AJAXPaypalCart Object
var cart = $('#cart').DCAJAXPaypalCart({
width: 600,
autoOpenWhenAdd: true,
openNewCheckOutWindow: true,
//themeColor:'#333',
//themeDarkColor:'#FFF',
header: 'AJAX Cart Demo',
footer: 'We accpet paypal, visa and master card. (This is a customizable footer)',
paypalOptions: {
business: 'tsangwl@digicrafts.com.hk',
page_style: 'digicrafts'
}
});
// Add the button
cart.addBuyButton("#macbook", {
name: 'MacBook', // Item name appear on the cart
thumbnail: 'med/macbook.jpg', // Thumbnail path of the item (Optional)
price: '999', // Cost of the item
shipping: 20 // Shipping cost for the item (Optional)
});
cart.addBuyButton("#macbookair", {
name: 'MacBook Air',
thumbnail: 'med/macbook.jpg',
price: '999',
shipping: 20
});
cart.addBuyButton("#macbookpro", {
name: 'MacBook Pro',
thumbnail: 'med/macbookpro.jpg',
price: '1199',
shipping: 0
});
cart.addBuyButton("#imac", {
name: 'iMac',
thumbnail: 'med/macbook.jpg',
price: '1199',
shipping: 0
});
cart.addBuyButton("#macmini", {
name: 'Mac Mini',
thumbnail: 'med/macbookpro.jpg',
price: '699',
shipping: 20
});
cart.addBuyButton("#macpro", {
name: 'Mac pro',
thumbnail: 'med/macpro.jpg',
price: '2499'
});
cart.addBuyButton("#macosx", {
name: 'Mac OS X',
thumbnail: 'med/macosx.jpg',
price: '99',
allowMultiple: false
});
// For code highlight
prettyPrint();
});
</script>
</head>
<body>
<div id="pageWrapper">
<!--End: Common Header -->
<div class="product_list">
<div class="product_list_header">Demo Store
<div class="sub"></div>
<div id="cart">Cart</div>
</div>
<div id="product_list" class="product_list_content">
<div class="product">
<div class="thumbnail">
<img src="med/macbook.jpg" />
</div>
<div class="caption">
<div class="text">
<div class="main">MacBook</div>
<div class="sub">(shipping $20)</div>
</div>
<div class="button" id="macbook">buy $999</div>
</div>
</div>
<div class="product">
<div class="thumbnail">
<img src="med/macbookair.jpg" />
</div>
<div class="caption">
<div class="text">
<div class="main">MacBook Air</div>
<div class="sub">(shipping $20)</div>
</div>
<div class="button" id="macbookair">buy $999</div>
</div>
</div>
<div class="product">
<div class="thumbnail">
<img src="med/macbookpro.jpg" />
</div>
<div class="caption">
<div class="text">
<div class="main">MacBook Pro</div>
<div class="sub">(free shipping)</div>
</div>
<div class="button" id="macbookpro">buy $1199</div>
</div>
</div>
<div class="product">
<div class="thumbnail">
<img src="med/macosx.jpg" />
</div>
<div class="caption">
<div class="text">
<div class="main">Mac OS X</div>
<div class="sub">(Purchase once|Download)</div>
</div>
<div class="button" id="macosx">buy $99</div>
</div>
</div>
<div class="product">
<div class="thumbnail">
<img src="med/imac.jpg" />
</div>
<div class="caption">
<div class="text">
<div class="main">iMac</div>
<div class="sub">(free shipping)</div>
</div>
<div class="button" id="imac">buy $1199</div>
</div>
</div>
<div class="product">
<div class="thumbnail">
<img src="med/macmini.jpg" />
</div>
<div class="caption">
<div class="text">
<div class="main">Mac Mini</div>
<div class="sub">(shipping $20)</div>
</div>
<div class="button" id="macmini">buy $699</div>
</div>
</div>
<div class="product">
<div class="thumbnail">
<img src="med/macpro.jpg" />
</div>
<div class="caption">
<div class="text">
<div class="main">Mac Pro</div>
<div class="sub">(free shipping)</div>
</div>
<div class="button" id="macpro">buy $2499</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
答案 0 :(得分:0)
也许您的服务器阻止连接以加载jquery库,因为您使用的是从Internet加载
{ script src =“https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js”type =“text / javascript”&gt; }
可以打开浏览器并检查控制台是否正确加载了jquery库? 在chrome中,只需右键单击 - &gt;检查元素 - &gt;控制台选项卡或f12 - &gt;控制台选项卡。