首先你要把按钮计算出来
那么onclick的calculateprice你必须调用函数chkprice()
- function chkpice()
- {
- var a=document.getElementById("options_1_text").value;
- var b=document.getElementById("options_2_text").value;
- var c=document.getElementById("options_3_text").value;
- var d=document.getElementById("options_4_text").value;
- var e=<?PHP echo $_product = $this->getProduct()->getPrice()?>;
- var f=(a+b+c+d)+e;
- var e=document.getElementById(('product-price-'+<?PHP echo $_product = $this->getProduct()->getId()?>)).innerHTML;
- $('product-price-'+<?PHP echo $_product = $this->getProduct()->getId()?>).innerHTML =''+e.replace(<?PHP echo $_product = $this->getProduct()->getPrice()?>,d)+'</span>';
- }
设置了options_1_text,options_2_text,options_3_text,options_4_text把你的id将会得到你的结果