基本上我正在尝试做一些在电子表格中非常容易但在网页中非常复杂(至少对我而言)的事情。
所以,我有 11 种书本尺寸,每种书本可以有 24 到 160 页,并且页面成本因书本尺寸而异(3 种不同的成本)。在用户选择下拉选项后,我需要得出一本书的总价。
据我所知,如果有人可以提供帮助,我将不胜感激!
<html>
<head>
<title><!--Sample--></title>
<script type="text/javascript">
<!-- BEGIN HIDING
document.onchange = function( e )
{ e = e ? e : window.event;
t = e.target ? e.target : e.srcElement;
if (( t.name ) && ( t.name == 'paginas' ))
{ var thisPhotobook = product.photobook;
var thisPrice = product.price;
var thisPaginas = product.paginas;
var thisTotal = product.total;
thisTotal.value = '$' + t.selectedIndex * parseFloat (thisPrice.value); }
}
// DONE HIDING -->
</script>
</head>
<body>
<br />
<form name="product" action="#" onsubmit="return false;">
<tr align="left">
<td width="118">
<span class="style3">Photobooks</span>
<select name="photobook" size="1">
<option value="129">Pequeño tapa blanda (A5) </option>
<option value="199">Pequeño tapa dura (A5) </option>
<option value="189">Clásico vertical tapa blanda (A4) </option>
<option value="255">Clásico horizontal tapa dura (A4) </option>
<option value="255">Clásico vertical tapa dura (A4) </option>
<option value="189">Cuadrado tapa blanda </option>
<option value="255">Cuadrado tapa dura </option>
<option value="329">Premium </option>
<option value="329">Premium tapa tela </option>
<option value="349">Super Premium (A3) </option>
<option value="349">Super Premium tapa tela (A3) </option>
</select>
<span class="style3">Páginas</span>
<select name="paginas" size="1">
<option>0 </option>
<option value="2">24 </option>
<option value="4">26 </option>
<option value="6">28 </option>
<option value="8">30 </option>
<option value="10">32 </option>
<option value="12">34 </option>
<option value="14">36 </option>
<option value="16">38 </option>
<option value="18">40 </option>
<option value="20">42 </option>
<option value="22">44 </option>
<option value="24">46 </option>
<option value="26">48 </option>
<option value="28">50 </option>
<option value="30">52 </option>
<option value="32">54 </option>
<option value="34">56 </option>
<option value="36">58 </option>
<option value="38">60 </option>
<option value="40">62 </option>
<option value="42">64 </option>
<option value="44">66 </option>
<option value="46">68 </option>
<option value="48">70 </option>
<option value="50">72 </option>
<option value="52">74 </option>
<option value="54">76 </option>
<option value="56">78 </option>
<option value="58">80 </option>
<option value="60">82 </option>
<option value="62">84 </option>
<option value="64">86 </option>
<option value="66">88 </option>
<option value="68">90 </option>
<option value="70">92 </option>
<option value="72">94 </option>
<option value="74">96 </option>
<option value="76">98 </option>
<option value="78">100 </option>
<option value="80">102 </option>
<option value="82">104 </option>
<option value="84">106 </option>
<option value="86">108 </option>
<option value="88">110 </option>
<option value="90">112 </option>
<option value="92">114 </option>
<option value="94">116 </option>
<option value="96">118 </option>
<option value="98">120 </option>
<option value="100">122 </option>
<option value="102">124 </option>
<option value="104">126 </option>
<option value="106">128 </option>
<option value="108">130 </option>
<option value="110">132 </option>
<option value="112">134 </option>
<option value="114">136 </option>
<option value="116">138 </option>
<option value="118">140 </option>
<option value="120">142 </option>
<option value="122">144 </option>
<option value="124">146 </option>
<option value="126">148 </option>
<option value="128">150 </option>
<option value="130">152 </option>
<option value="132">154 </option>
<option value="134">156 </option>
<option value="136">158 </option>
<option value="138">160 </option>
</select>
<span class="style3">Precio por página</span>
<select name="price" >
<option value="2">2 </option>
<option value="2,5">2,5 </option>
<option value="5">5 </option>
</select>
<input name="total" type="text" value="0" size="5" style="text-align: center;" />
</td>
</tr>
</form>
</body>
</html>