[Javascript] form array2 values

Michael Borchers borchers at tridem.de
Wed May 4 08:29:32 CDT 2005


I have an array starting with 0 and ending with 5.
I need my function to change the products_id[0][products_price] field with the desired price
regarding the products_id[0][products_id] field. how can i realize this?


<form action="..." method="post" name="orders">
<select name="products_id[0][products_id]">
...
</select>
<input type="text" name="products_id[0][products_price]" id="0" value="0,00 &euro;" size="10" onFocus="products_id2products_price(0)">
...
</form>

<script language="JavaScript" type="text/javascript">
function products_id2products_price(NUM_ROWS)
{
	var products_id = document.orders.products_id[NUM_ROWS][products_id];
	
	if(products_id == '1') { var products_price = '229.0000'; }
	if(products_id == '3') { var products_price = '149.0000'; }

	document.orders.products_id[NUM_ROWS][products_price].value = products_price;
}



More information about the Javascript mailing list