Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: AW: Checkboxes


Message #1 by =?iso-8859-1?Q?Hans_J=F6rg_Friedrich?= <hans.friedrich@b...> on Wed, 15 Aug 2001 09:03:49 +0200
Hello Julian

if you try an assignment instead of a comparison ("=3D" instead of 
"=3D=3D")
it should work.

Hth
Hans

-----Urspr=FCngliche Nachricht-----
Von: Julian Sinclair [mailto:j.sinclair@f...]
Gesendet: Dienstag, 14. August 2001 17:54
An: javascript
Betreff: [javascript] Checkboxes


Hi all,

need a bit of help here.

I have a form where the user can select one or more of a number of
criteria
to search by. By ticking a check box the corresponding criteria is added
to
the search string.

What I would like to do is if a user instead of ticking the checkbox
just
types directly into the text box the checkbox is ticked automatically. I
have tried the following function but this does not put a tick in the
checkbox. Can anyone tell me what I need to do ?

The alerts are just there to check that the correct box was being
selected
from the array (it is) and the array is there to match checkbox/textarea
pairs.


//Function to automatically tick check box if text area is selected.
function tickBox(index)
{
	var tickIndex =3D new Array(0,3,6);
	var newIndex =3D tickIndex[index];
	alert(document.search_form.elements[newIndex].name);
	document.search_form.elements[newIndex].checked =3D=3D true
	alert(document.search_form.elements[newIndex].checked);
}

Julan

  Return to Index