Click to See Complete Forum and Search --> : passing arrays


travisb
09-15-2003, 12:45 PM
I am having trouble trying to get multiple values in an array from an iframe to a function in the parent:

in the iframe:
<div onClick="parent.passpro('prod_array[]:[Big Arm 1 seater][35401]');">

and putting them in the form on the parent with:
function passpro(array[]) {
document.order_form.pro.value = array[0];
document.order_form.mod.value = array[1];
}

I have been looking for a couple hours and cannot find any examples of how to do this.

Jona
09-15-2003, 01:25 PM
<script type="text/javascript"><!--
function passpro(ary){
document.order_form.pro.value = ary[0];
document.order_form.mod.value = ary[1];
}
//--></script>


Your IFrame:


<div onClick="parent.passpro(ary=new Array('value0', 'value1'));">


[J]ona

travisb
09-15-2003, 02:11 PM
It does not seem to be working.

I have in my inline frame:
<div onClick="parent.passpro(prod_array = new Array(Big Arm 1 seater,35401));">

and in the parent:
<script language="JavaScript">

function passpro(prod_array) {
document.order_form.pro.value = prod_array[0];
document.order_form.mod.value = prod_array[1];
}

</script>

any indeas?

Jona
09-15-2003, 02:14 PM
<div onClick="parent.passpro(prod_array = new Array('Big Arm 1 seater', '35401'));">


[J]ona

travisb
09-15-2003, 02:14 PM
never mind.
I forgot the single quotes around
Big Arm 1 seater,35401

It should be
'Big Arm 1 seater','35401'

Thanks for your help.

Jona
09-15-2003, 02:17 PM
Welcome you are. :)

[J]ona