[Javascript] Dynamic Checkbox onClick

Andrew McCombe andrew at euperia.com
Mon Jan 27 08:21:58 CST 2003


Hi

I'm sorry if this has been sent once, but I had my settings set to digest
and I've now turned them off, so if there were any replies then I probably
wont get them. Once again, my apologies.  I really could do with the help
though.


I'm creating a form with a variable amount of checkboxes.  I've got the
following that is working fine:

	var check = document.createElement("input");

	check.setAttribute("type","checkbox");
	check.setAttribute("name","fault[]");
	check.setAttribute("value",handset[myHandset][i]);
	check.setAttribute("onClick","faultChecked(this);");

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?

Andrew




More information about the Javascript mailing list