The complete code is as follows : HTML code: Copy code The code is as follows:<!-- EOT; if($step==1){ print <<<EOT --> <div class="main"> <form name="form_order" method="post" action="?action=$atc" enctype="multipart/form-data"> <div class="shopcartbox"> <div class="shopcart2"> <!-- EOT; $total_all=0; $jinbi_all=0; foreach($listdb AS $name=>$array){ $total=0; $jinbi=0; print <<<EOT --> <ul class="u1"> <li class="l1"><div><input type="checkbox" name="" id="" checked="checked" /> Select All</div></li> <li class="l2">Products</li> <li class="l3">Return points</li> <li class="l4">Quantity</li> <li class="l5">Unit price</li> <li class="l6">Total price</li> </ul> <!-- EOT; foreach($array AS $rs){ $ rs[picurl]=$rs[picurl]?$rs[picurl]:"$webd[www_url]/images/default/nopic.jpg"; $rs[picurl]=tempdir($rs[picurl]); @extract($db->get_one("SELECT content FROM {$_pre}content_$rs[mid] WHERE id=$rs[id]")); $content=preg_replace('/<([^<]*)>/is',"",$content); //Filter out HTML code $content=preg_replace('/ | | /is',"",$content); //Remove extra spaces $content= get_word($content,100); $total+=$rs[price2]; $total_all+=$rs[price2]; $jinbi+=$rs[jinbi2]; $jinbi_all+=$rs[jinbi2]; print <<<EOT --> <ul class="u2" id="tr$rs[id]"> <li class="l1"><input type="checkbox" name="" id="" checked="checked" /></li> <li class="l2"><a href="bencandy.php?city_id=$rs[city_id]&fid=$rs[fid]&id=$rs[id]" class="pic" target="_blank"><img src="$rs[picurl]"height="90" onError="this.src='$webdb[www_url]/images/default/nopic.jpg'"/></a><h3><a href="bencandy.php?city_id=$rs[city_id]&fid=$rs[fid]&id=$rs[id]" target="_blank">$rs[title]</a></h3><p>$rs[content]</p></li> <li class="l3">0 points</li> <li class="l4">{$rs[num]}</li> <li class="l5"><font>{$rs[price]}</font> yuan</li> <li class="l6"><font id="showid$rs[id]" class="shows$rs[uid]">{$rs[price2]}</font> yuan</li> </ul> <!-- EOT; }print <<<EOT --> <ul class="u3"> <div class="fr"> <p class="p1"> Shipping Method: <!-- EOT; if($rs[youfei]=="1"){print <<<EOT --> <select id="collect" name="postdb[youfei]" onchange="Add(this.value,'total$rs[uid]')"> <option value='10'>Express delivery: 10 yuan</option> <option value='20'>EMS: 20 yuan</option> <option value='50'>Ordinary mail: 50 yuan</option> </select> <SCRIPT LANGUAGE="JavaScript"> <!-- function changenum(price,type,id,uid){ price=parseFloat(price); num = parseInt($("#numid"+id).val()); if(type==1){ //Increase num++; } else if(type==-1){ //reduce num--; } else if(type==0){ //delete num=0 } if(type!=0 && num==0){ alert('The quantity cannot be less than 1. If you do not want to purchase, please select delete'); num=1; } $("#numid"+id).val(num); $("#showid"+id).html(changeTwoDecimal(String(num*price))); obj=$(".shows"+uid); thispice = 0; for(i=0;i<obj.size();i++){ thispice+=parseFloat(obj.eq(i).html()); } $("#total"+uid).html(thispice); if(type==0){ $.get("join.php?type=setcookie&cid="+id+"&num="+0); $("#tr"+id).hide(); }else{ $.get("join.php?type=setcookie&cid="+id+"&num="+num+"&"+Math.random()); } obj2 = $(".totalprice"); if(obj2.size()>1){ thispice = 0; for(i=0;i<obj2.size();i++){ thispice+=parseFloat(obj2.eq(i).html()); } $("#total_all").html(thispice); } } function changeTwoDecimal(x){ var f_x = parseFloat(x); if(isNaN(f_x)){ alert('function:changeTwoDecimal->parameter error'); return false; } var f_x = Math.round(x*100)/100; return f_x; } function Add(m,id){ document.getElementById(id).innerHTML = parseInt(document.getElementById(id).getAttribute("total")+parseInt(m)) //--> </SCRIPT> <!-- EOT; } print <<<EOT --> </p> <p class="p2"><strong>Total number of store items: </strong>(including shipping) <font id="total$rs[uid]" class="totalprice">$total</font> yuan</p> </div> <div class="fl"> <p class="p1"><stron>Seller: {$rs[username]}</strong></p> <p class="p2">Leave a message to the seller: <textarea name='postdb[content]' id='atc_content' >$rsdb[content]</textarea></p> </div> </ul> <!-- EOT; }print <<<EOT --> <!-- EOT; if(count($listdb)>1){ print <<<EOT --> <ul class="u4"><div><strong>Total price of goods:</strong>(including shipping) <font id="total_all">$total_all</font> yuan</div></ul> <!-- EOT; } print <<<EOT --> </div> </div> <div class="clear20"></div> <div class="shoppostbox"> <div class="shoppostdiv"> <div class="shopinfo"> <p><span>Actual payment:</span> <!-- EOT; if(count($listdb)>1){ print <<<EOT --> <font id="total$rs[uid]" class="totalprice">$total_ll</font> yuan <!-- EOT; } else{print <<<EOT --> <font id="total$rs[uid]" class="totalprice">$total</font> yuan <!-- EOT; }print <<<EOT --> </p> {$address_selects} </div> </div> <div class="shop_postbtn"> <input type="submit" name="imageField" id="imageField" class="shop-submit" value=" " /> <input type="hidden" name="fid" value="$fid"> <input type="hidden" name="id" value="$id"> <input type="hidden" name="cid" value="$cid"> <input type="hidden" name="postdb[title]" id="atc_title" size="50" value="$infodb[title]"> </div> <!-- EOT; if($job=='edit'){print <<<EOT --> <SCRIPT LANGUAGE="JavaScript"> <!-- $(document).ready(function(){ $("#othermore").show();$("#dobutton").hide(); }); //--> </SCRIPT> <a href="?action=del&id=$id&cid=$cid&fid=$rsdb[fid]" onClick="return confirm('Are you sure you want to delete?');">Delete</a> <!-- EOT; }print <<<EOT --> </div> <script language="JavaScript"> <!-- function chooseAddress(selObj){ value = selObj.options[selObj.selectedIndex].value; if(value=='-1'){ ifHideMoreTr(false); } else{ ifHideMoreTr(true); } } function ifHideMoreTr(type){ var arr = ["username","phone","mobphone","email","qq","postcode","address" ]; $("#othermore input").each(function (i){ if(jQuery.inArray(this.name.replace(/postdb\[order_([\w]+)\]/, "$1"),arr)!=-1){ obj=$(this).parent().parent(); if(type==true){ obj.hide() }else{ obj.show() } } }); } $(document).ready(function(){ sObj = $("#choose_Address"); if(sObj.get(0).options.length==1||"$job"=="edit"){ sObj.parent().parent().hide ifHideMoreTr(false); } else{ ifHideMoreTr(true); } }); //--> </script> </form> </div> <!-- EOT; } print <<<EOT --> <div class="clear20"> </div> </div> <!-- EOT; ?> --> The desired effect is : When I choose EMS 20 shipping fee, when I click the shipping fee in the drop-down box in the shipping method, the total price of the store + 20 yuan will be used. When I click Surface Mail 50 yuan, the total price of the store + 50 yuan. I said it should be displayed in two places because if there are products from two different merchants, there will be the total price of the two merchants combined and the total price of the merchant's products themselves. The solution is as follows : Copy code The code is as follows:<select id="collect" name="postdb[youfei]" onchange="Add(this.value,'total$rs[uid]')"> <option value='10'>Express delivery: 10 yuan</option> <option value='20'>EMS: 20 yuan</option> <option value='50'>Ordinary mail: 50 yuan</option> </select> Operate the name="postdb[youfei]" attribute, set the parameter named postdb[youfei] in the action, that is: private String postdb[youfei], and then generate the get/set method to get the value! |
<<: 10 Deadly Semantic Mistakes in Web Typography
>>: Teach you how to implement a circular/fan-shaped menu in 2 minutes (basic version)
From handicraft design to graphic design to web de...
Table of contents 1. classList attribute 2. Pract...
mysql-5.7.17-winx64 is the latest version of MySQ...
1. Introduction A few days ago, a development col...
How to implement the "Set as homepage" ...
In MySQL, you can use the SQL statement rename ta...
In ordinary projects, I often encounter this prob...
need: Implement dynamic display of option values ...
1. The effect diagram implemented in this article...
The first line of a Docker image starts with an i...
You must have saved other people’s web pages and l...
No matter how wonderful your personal website is,...
Optimization ideas There are two main optimizatio...
Preface: I have always wanted to know how a SQL s...
describe Returns the time interval between two da...