[Javascript] Dynamic Checkbox onClick

Andrew McCombe andrew at euperia.com
Mon Jan 27 08:31:22 CST 2003


Sorry, the last email was sent before I finished composing!


> I want to call a function 'faultChecked()' when the box is
> clicked.  Setting
> the attribute as above doesn't work - is it the right way to set it or is
> there another way?

I've now got the following:

		check.setAttribute("type","checkbox");
		check.setAttribute("name","fault[]");
		check.setAttribute("value",handset[myHandset][i]);
		check.onClick=faultChecked(this);
		var td1 = document.createElement("TD");
		td1.appendChild(check);


The functon is called from an onLoad call.  Trouble is, when displaying the
checkbox the onClick event is triggered. Once it's done calling (there are
over 20 checkboxes being displayed) the onClick then doesn't call the
function.

Why?

Andrew




More information about the Javascript mailing list