Links

Lists

Latest Updates

Ruby On Rails List
Python list
Advanced Java
The JavaScript List
Apache Users
Full Disclosure
Linux Security

Search the archives!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Javascript] Dynamic Checkbox onClick


  • From: javascript@xxxxxxxxxx (Andrew McCombe)
  • Subject: [Javascript] Dynamic Checkbox onClick
  • Date: Mon, 27 Jan 2003 14:31:22 -0000

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