相思资源网 Design By www.200059.com
完整的代码如下:
HTML code:
复制代码代码如下:
<!--
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" /> 全选</div></li>
<li class="l2">商品</li>
<li class="l3">返积分</li>
<li class="l4">数量</li>
<li class="l5">单价</li>
<li class="l6">总价</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); //把HTML代码过滤掉
$content=preg_replace('/ | | /is',"",$content); //把多余的空格去除掉 $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="/UploadFiles/2021-03-30/$rs[picurl]"><li class="l3">0分</li>
<li class="l4">{$rs[num]}</li>
<li class="l5"><font>{$rs[price]}</font>元</li> <li class="l6"><font id="showid$rs[id]" class="shows$rs[uid]">{$rs[price2]}</font>元</li> </ul>
<!--
EOT;
}print <<<EOT
-->
<ul class="u3">
<div class="fr">
<p class="p1">
运送方式:
<!--
EOT;
if($rs[youfei]=="1"){print <<<EOT
-->
<select id="collect" name="postdb[youfei]" onchange="Add(this.value,'total$rs[uid]')">
<option value='10'>快递:10元</option>
<option value='20'>EMS:20元</option>
<option value='50'>平邮:50元</option>
</select>
<SCRIPT LANGUAGE="JavaScript">
<!--
function changenum(price,type,id,uid){
price=parseFloat(price);
num = parseInt($("#numid"+id).val());
if(type==1){ //增加
num++; }
else if(type==-1){ //减少
num--; }
else if(type==0){ //删除
num=0 }
if(type!=0 && num==0){
alert('数量不能小于1,若不想购买,请选择删除');
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>店铺商品合计:
</strong>(含运费) <font id="total$rs[uid]" class="totalprice">$total</font>元</p>
</div>
<div class="fl">
<p class="p1"><stron>卖家:{$rs[username]}</strong></p>
<p class="p2">给卖家留言:<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>商品总价:</strong>(含运费) <font id="total_all">$total_all</font>元</div></ul> <!-- EOT; }
print <<<EOT
-->
</div>
</div>
<div class="clear20"></div> <div class="shoppostbox">
<div class="shoppostdiv">
<div class="shopinfo">
<p><span>实付款:</span>
<!--
EOT;
if(count($listdb)>1){
print <<<EOT
-->
<font id="total$rs[uid]" class="totalprice">$total_ll</font>元
<!--
EOT; }
else{print <<<EOT
-->
<font id="total$rs[uid]" class="totalprice">$total</font>元
<!--
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('你确认要删除吗?');">删除</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;
?>
-->
想要的效果是:
当我选择ems20运费时,在运送方式中点击下拉框中的运费时那么就用 店铺合计总价+ 20元 当我点击平邮50元时,店铺合计总价+ 50元.
我说的要二个地方显示,是因为他如果存在二个不同的商家的商品时,会有二个商家合起来的总价和 商家商品本身的总价。
解决方法如下:
复制代码代码如下:
<select id="collect" name="postdb[youfei]" onchange="Add(this.value,'total$rs[uid]')">
<option value='10'>快递:10元</option>
<option value='20'>EMS:20元</option>
<option value='50'>平邮:50元</option>
</select>
对name=”postdb[youfei]“属性进行操作,在action中设置名为postdb[youfei]的参数,即:private String postdb[youfei],然后生成get/set方法,就可以取到值了!
HTML code:
复制代码代码如下:
<!--
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" /> 全选</div></li>
<li class="l2">商品</li>
<li class="l3">返积分</li>
<li class="l4">数量</li>
<li class="l5">单价</li>
<li class="l6">总价</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); //把HTML代码过滤掉
$content=preg_replace('/ | | /is',"",$content); //把多余的空格去除掉 $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="/UploadFiles/2021-03-30/$rs[picurl]"><li class="l3">0分</li>
<li class="l4">{$rs[num]}</li>
<li class="l5"><font>{$rs[price]}</font>元</li> <li class="l6"><font id="showid$rs[id]" class="shows$rs[uid]">{$rs[price2]}</font>元</li> </ul>
<!--
EOT;
}print <<<EOT
-->
<ul class="u3">
<div class="fr">
<p class="p1">
运送方式:
<!--
EOT;
if($rs[youfei]=="1"){print <<<EOT
-->
<select id="collect" name="postdb[youfei]" onchange="Add(this.value,'total$rs[uid]')">
<option value='10'>快递:10元</option>
<option value='20'>EMS:20元</option>
<option value='50'>平邮:50元</option>
</select>
<SCRIPT LANGUAGE="JavaScript">
<!--
function changenum(price,type,id,uid){
price=parseFloat(price);
num = parseInt($("#numid"+id).val());
if(type==1){ //增加
num++; }
else if(type==-1){ //减少
num--; }
else if(type==0){ //删除
num=0 }
if(type!=0 && num==0){
alert('数量不能小于1,若不想购买,请选择删除');
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>店铺商品合计:
</strong>(含运费) <font id="total$rs[uid]" class="totalprice">$total</font>元</p>
</div>
<div class="fl">
<p class="p1"><stron>卖家:{$rs[username]}</strong></p>
<p class="p2">给卖家留言:<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>商品总价:</strong>(含运费) <font id="total_all">$total_all</font>元</div></ul> <!-- EOT; }
print <<<EOT
-->
</div>
</div>
<div class="clear20"></div> <div class="shoppostbox">
<div class="shoppostdiv">
<div class="shopinfo">
<p><span>实付款:</span>
<!--
EOT;
if(count($listdb)>1){
print <<<EOT
-->
<font id="total$rs[uid]" class="totalprice">$total_ll</font>元
<!--
EOT; }
else{print <<<EOT
-->
<font id="total$rs[uid]" class="totalprice">$total</font>元
<!--
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('你确认要删除吗?');">删除</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;
?>
-->
想要的效果是:
当我选择ems20运费时,在运送方式中点击下拉框中的运费时那么就用 店铺合计总价+ 20元 当我点击平邮50元时,店铺合计总价+ 50元.
我说的要二个地方显示,是因为他如果存在二个不同的商家的商品时,会有二个商家合起来的总价和 商家商品本身的总价。
解决方法如下:
复制代码代码如下:
<select id="collect" name="postdb[youfei]" onchange="Add(this.value,'total$rs[uid]')">
<option value='10'>快递:10元</option>
<option value='20'>EMS:20元</option>
<option value='50'>平邮:50元</option>
</select>
对name=”postdb[youfei]“属性进行操作,在action中设置名为postdb[youfei]的参数,即:private String postdb[youfei],然后生成get/set方法,就可以取到值了!
标签:
select下拉框,id
相思资源网 Design By www.200059.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
相思资源网 Design By www.200059.com
暂无如何把select下拉框的值传到id中实现代码的评论...
RTX 5090要首发 性能要翻倍!三星展示GDDR7显存
三星在GTC上展示了专为下一代游戏GPU设计的GDDR7内存。
首次推出的GDDR7内存模块密度为16GB,每个模块容量为2GB。其速度预设为32 Gbps(PAM3),但也可以降至28 Gbps,以提高产量和初始阶段的整体性能和成本效益。
据三星表示,GDDR7内存的能效将提高20%,同时工作电压仅为1.1V,低于标准的1.2V。通过采用更新的封装材料和优化的电路设计,使得在高速运行时的发热量降低,GDDR7的热阻比GDDR6降低了70%。