一:参数分为形参和实参,function triangleCoordschange(arr1,arr2)这里面是形参,triangleCoordschange(arr1,arr2)这里面是实参,参数通过实参传到形参,triangleCoordschange(arr1,arr2)是调用函数,给此函数赋值就可以了。
二:获取参数,var arr1=document.getElementById("属性名");当然还有getElementByTagName, 这要看你代码了
/* *
* 添加商品到购物车
*/
function addToCart(goodsId, parentId)
{
var goods = new Object();
var spec_arr = new Array();
var fittings_arr = new Array();
var number = 1;
var formBuy = document.forms['ECS_FORMBUY'];
var quick = 0;
var selected_num = '';
// 检查是否有商品规格
if (formBuy)
{
spec_arr = getSelectedAttributes(formBuy);
if (formBuy.elements['number'])
{
number = formBuy.elements['number'].value;
}
quick = 1;
}
selected_num = document.getElementById("selected_num").value;
goods.quick = quick;
goods.spec = spec_arr;
goods.goods_id = goodsId;
goods.number = number;
goods.selected_num = selected_num;
goods.parent = (typeof(parentId) == "undefined") ? 0 : parseInt(parentId);
Ajax.call('/flow.php?step=add_to_cart', 'goods=' + goods.toJSONString(), addToCartResponse, 'POST', 'JSON');
}