poate am gresit eu dar ori cum sper sa ma ajutati. am un script care imi valorile de la select si le face update cu valoare produsul.Faza este ca m-am impotmolit aici, dau codu in html mai jos, normal facut repede ca exemplu, ori cum ar fi un mare ajutor daca ati reusi sa ma ajutati.
Cod: Selectaţi tot
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html dir="LTR" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>a</title>
<script language="javascript"><!--
function popupWindow(url) {
window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,left=150')
}
function textCounter(field,counter,maxlimit,linecounter) {
// text width//
var fieldWidth = parseInt(field.offsetWidth);
var charcnt = field.value.length;
// trim the extra text
if (charcnt > maxlimit) {
field.value = field.value.substring(0, maxlimit);
} else {
// progress bar percentage
var percentage = parseInt(100 - (( maxlimit - charcnt) * 100)/maxlimit) ;
document.getElementById(counter).style.width = parseInt((fieldWidth*percentage)/100)+"px";
document.getElementById(counter).innerHTML="Limit: "+percentage+"%"
// color correction on style from CCFFF -> CC0000
setcolor(document.getElementById(counter),percentage,"background-color");
}
}
function setcolor(obj,percentage,prop){
obj.style[prop] = "rgb(80%,"+(100-percentage)+"%,"+(100-percentage)+"%)";
}
// EOF Product Type Feature
//--></script>
<script language="javascript">
<!--
function FormatNumber(num)
{
if(isNaN(num)) { num = "0"; }
sign = (num == (num = Math.abs(num)));
num = Math.floor(num*100+0.50000000001);
cents = num%100;
num = Math.floor(num/100).toString();
if(cents<10) { cents = "0" + cents; }
for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
{
num = num.substring(0,num.length-(4*i+3))+','+ num.substring(num.length-(4*i+3));
}
return (((sign)?'':'-') + num + '.' + cents);
}
function showPrice(form)
{
var myTotalPrice = 0;
var showUP = 0;
var myMathProblem = "";
myItemPrice = parseFloat(form.nuPrice.value);
for (var i = 0; i < form.elements.length; i++)
{
var e = form.elements[i];
if ( e.type == 'select-one' )
{
showUP = 1;
Item = e.selectedIndex;
myPrice = e.options[Item].text;
myDollarSign = myPrice.indexOf("$",0)
if ( myDollarSign != "-1" )
{
myParSign = myPrice.indexOf(")", myDollarSign);
myAttributeString = myPrice.substring(myDollarSign+1, myParSign);
myAttributeString = myAttributeString.replace(/,/,"");
myAttributePrice = parseFloat(myAttributeString);
myMathProblem = myPrice.charAt(myDollarSign - 1);
} else { myAttributePrice = 0; }
if (myMathProblem == "-")
{
myTotalPrice = myTotalPrice - myAttributePrice;
} else {
myTotalPrice = myTotalPrice + myAttributePrice;
}
}
}
if ( showUP )
{
myTotalPrice = FormatNumber(myTotalPrice + myItemPrice);
document.getElementById("productNEWprice").innerHTML = "Subtotal $" + myTotalPrice;
}
}
//-->
</script>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" onload="showPrice(cart_quantity)">
</table>
<table border="0" width="100%" cellspacing="3" cellpadding="3">
<tr>
<td width="125" valign="top"><table border="0" width="125" cellspacing="0" cellpadding="2">
<!-- left_navigation //-->
<!-- left_navigation_eof //-->
</table></td>
<!-- body_text //-->
<td width="100%" valign="top"><form name="cart_quantity" action="p750/product_info.php?cPath=3_15&products_id=20&action=add_product" method="post"><table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
<td><div id="productNEWprice"></div></td>
<td class="pageHeading" align="right" valign="top">$54.99</td>
<input type="hidden" name="nuPrice" value="54.99">
</table></td>
<td class="main">
<tr><td class="main">checkbox: </td><td class="main"><input type="checkbox" name="id[7]" value="3">(+$123.00) </td></tr> <tr >
<td class="main">Memory:</td>
<td class="main"><select name="id[4]" onChange='showPrice(this.form);'><option value="4">32 mb (+$20.00)</option><option value="5">Value</option></select></td>
</tr>
<tr>
<td class="main">radio2:</td>
<td class="main"><table>
<tr><td class="main">
<input type="radio" name="id[6]" value="7" CHECKED>
Deluxe</tr></td>
<tr><td class="main">
<input type="radio" name="id[6]" onChange='showPrice(this.form);' value="1" onkeypress="showPrice(this.form);">4 mb(+$15.00)  </tr></td></table></td>
</tr>
<tr>
<td class="main">text:</td>
<td class="main"><input type="text" name ="id[txt_8]" size="40" maxlength="40" value=""> ASDFASDFASDFASD(+$23.00)</td>
</tr>
</form></td>
<script language="javascript">
<!--
showPrice(cart_quantity);
//-->
</script>
</table></td>
</tr>
</table>
<!-- body_eof //-->