[Cialug] JS Question

L. V. Lammert lvl at omnitec.net
Mon Jan 28 13:40:07 CST 2013


Since the topic today has been JS, .. could someone please tell me what is
wrong the first line of this function? Every time I try to do some simple
stuff on a page I am reminded as to why I hate JS <g>!

	PrintedAlso is a checkbox, with 1 as a checked value
	On check, the first line consistantly returns a "Typedef
	Error = VV Undefined".
	The last four lines run just fine, updating the respective
	elements.

My question how can VV be undefined in the first line and *defined* in
the third? [VV is passed as "this.form" on the OnChange event for each
element.]

function UpdateTotal(VV) {
	if (VV.PrintedAlso.value="1") { VV.TotalPrinted.value=5; }	<<
	else { VV.TotalPrinted.value==0; }
	VV.TotalRegular.value = fmt(sub1=VV.NumRegular.value * 10.00);
	VV.TotalJunior.value = fmt(sub2=VV.NumJunior.value * 2.00);
	VV.TotalPrinted.value = fmt(sub3=VV.TotalPrinted);
	VV.GrandTotal.value = fmt(sub1 + sub2 + sub3);
}

	TIA!

	Lee


More information about the Cialug mailing list