㈠ 怎麼實現購物車結算
你好:抄這個的話,你其實很簡單的襲,你的應該做成個form,之後提交表單,獲取到對應的屬性名稱的值,然後就可以計算了,必須用post提交。也可以js算出來結果然後直接
http://lcoalhost:8080/Root?sum =500;這樣提交post請求來實現
㈡ 我在做一個購物車結算的asp 用的是GridView 當購物車中的數量改變更新後 畫面中的總金額不會改變
好棒奧
㈢ ASP.NET如何計算出購物車里的合計金額
你的sql有問題 把SQL列印到控制台 然後到資料庫去執行 看哪錯了!
㈣ 你的ecshop購物車 做選擇結算嗎 可以發給我一份代碼 謝謝 大
你可以去下載一個免費的ecshop模板去看看
㈤ js對話框,我想做一個購物車結算功能,在結算的時候會花上幾秒鍾時間,這時候
稍等一下,我貼個demo代碼給你
這個是HTML頁面
<!DOCTYPEhtml>
<html>
<head>
<metahttp-equiv="Content-Type"content="text/html;charset=utf-8"/>
<title>Demo</title>
<scripttype="text/javascript"src="
<styletype="text/css">
body{font-size:14px;}
.btn{background:#f22d00;color:#fff;display:inline-block;width:120px;height:50px;line-height:50px;text-align:center;font-family:'LantingheiSC','MicrosoftYahei';font-size:20px;-webkit-border-radius:2px;-moz-border-radius:2px;-ms-border-radius:2px;border-radius:2px;text-decoration:none;cursor:pointer;}
.mask{background:#000;opacity:0.5;height:50px;width:120px;position:absolute;left:8px;top:8px;color:#fff;line-height:50px;text-align:center;font-weight:bold;}
.maskimg{vertical-align:-3px;margin-right:5px}
</style>
</head>
<body>
<divclass="file-box">
<formmethod="post"id="demo_form">
<ahref="javascript:;"class="btn"id="J_Go"><span>結 算</span></a>
</form>
</div>
</body>
<scripttype="text/javascript">
$(document).ready(function(){
$('#J_Go').click(function(){
//修改結算按鈕的背景顏色
$('#J_Go').css('background','#ccc');
//添加遮罩效果
varhtml='<spanclass="mask">';
html+='<imgsrc="loading.gif">請稍候...</san>';
$('#demo_form').append(html);
//提交表單
varurl='test.php';
$.post(url,{},function(r){
if(r.status==1){
//提交表單後返回成功,則去除遮罩
$('.mask').remove();
//修改結算按鈕顏色
$('#J_Go').css('background','#f22d00');
}else{
alert(r.info);
}
},'json');
});
returnfalse;
});
</script>
</html>
這個是PHP頁面
<?php
$info['status']=1;
$info['info']='操作成功!';
exit(json_encode($info));
?>
這是效果圖示
本想上傳個附件的,一個完整的實例Demo的,但是現在才三級,不支持上傳附件。
若有任何疑問,歡迎追問!
㈥ 在java中,怎麼通過javascript來實現購物車里所有商品價格的總價結算
用JQuery選擇器,操作DOM元素,進行商品加減操作(動態數據可以參考ajax技術)
㈦ 求一個JAVA里用map集合寫一個購物車的代碼,購物車實現商品的添加,刪除,查詢和結算,寫了半天沒
建一個靜態的Map集合 做購物車的集合
key值 放商品的ID value 放 商品對象.
對map 增刪改查就好了.. 結算完了 清空map
㈧ 求asp購物車商品價格計算的代碼 望高手指教!謝謝!
這算是個什麼問題啊,ASP是伺服器腳本,購物車是程序實現的功能
價格計算的代碼是什麼東西?加、減、乘、除?
㈨ 我現在做一個網上書店,購物車結算金錢怎麼統計這個EL表達式怎麼寫
在畫面載入的時候調用求和sum方法。
function sum() {
var sum = 0;
for (var i = 1; i <= $("#shopCart").rows.length; i++) {
sum += parseFloat($("#shopCart").rows[i].cells[4].innerText);
}
}
然後把這個sum顯示到紅線部分就專O了。
註:屬shopCart是table的ID
㈩ 購物車的Java代碼
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;public class ShoppingCartManager {
HashMap<String, String> hm=new HashMap<String, String>();
float totlePrice=0;
//添加book到購物車
public void addBook(String bookId,String bookQuantity){
if(hm.containsKey(bookId)){
int value=Integer.parseInt(hm.get(bookId));
value+=Integer.parseInt(bookQuantity);
hm.put(bookId, value+"");
}else{
hm.put(bookId, bookQuantity);
}
}
//修改數量
public void updateQuantity(String bookId,String bookQuantity){
hm.put(bookId, bookQuantity);
}
//獲取購物車的所有信息 並計算總價
public ArrayList<BookBean> getShoppingCart(){
ArrayList<BookBean> al=new ArrayList<BookBean>();
Iterator<String> i=hm.keySet().iterator();
String ids="";
BookTableManager btm=new BookTableManager();
while(i.hasNext()){
ids=ids+","+i.next();
}
al= btm.selectByBookIds(ids);
totlePrice=0; //清空總價,防止無限累計
for(int j=0;j<al.size();j++){
BookBean bb=al.get(j);
totlePrice+=bb.getPrice()*Integer.parseInt(getQuantityById(bb.getBookId()+""));
}
return al;
}
//獲取總價
public float getTotlePrice(){
return totlePrice;
}
//根據ID獲取數量
public String getQuantityById(String id){
String quantity=hm.get(id);
return quantity;
}
//清空購物車
public void clear(){
hm.clear();
}
//刪除購物車中的一本書
public void deleteById(String id){
hm.remove(id);
}
}