Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript_howto thread: index of control in control array


Message #1 by David Ames <davida@i...> on Wed, 12 Dec 2001 07:18:53 +1100
Hi.
i don't konw if I am getting u rgiht but this function will shows the input 
types in the form. hope it's for any help.

function checktypes() {

	for (x = 0; x < document.forms[0].length; x++) {

		alert(document.forms[0].elements[x].type);
	}
}

regards
Steve

>From: Konstantin Sokolovskiy <ske@u...>
>Reply-To: "JavaScript HowTo" <javascript_howto@p...>
>To: "JavaScript HowTo" <javascript_howto@p...>
>CC: "JavaScript HowTo" <javascript_howto@p...>
>Subject: [javascript_howto] Re: index of control in control array
>Date: Thu, 13 Dec 2001 12:49:29 +0300
>
>Hello David,
>
>caller variable is a reference to your input field.
>You can use it as a input object, for example:
>
>function test(caller)
>{
>      alert(caller.name + " value = '" caller.value + "'");
>}
>
>Tuesday, December 11, 2001, 11:18:53 PM, you wrote:
>
>DA> Hey all,
>
>DA> I would like to be able to know which control in a control array was 
>clicked
>DA> when passing a reference to the control object.
>
>DA> EG:
>DA> <script>
>DA>   function test(caller) {
>DA>      -- HERE I want to see which myTest was clicked.    <= here is the
>DA> problem
>DA> }
>
>DA> </script>
>
>DA> <form>
>DA>   <input type=text name=myTest onclick=test(this)>
>DA>   <input type=text name=myTest onclick=test(this)>
>DA>   <input type=text name=myTest onclick=test(this)>
>DA> </form>
>
>DA> Can someone please joint me in the right direction,
>
>
>DA> Regards,
>DA> DAVID AMES
>DA> I.T. Co-Ordinator
>DA> IN-SITE
>DA> Phone 1300-134-435
>DA> Fax: 9872-5566
>DA> Direct: 8873 2207
>
>
>
>DA> ---
>DA> 
>DA> 
>$subst('Email.Unsub').
>
>
>
>--
>Best regards,
>  Konstantin Sokolovskiy (mailto:ske@u...)
>  ICQ# 44424442
>
>
>$subst('Email.Unsub').




_________________________________________________________________
Kom med i världens största e-posttjänst; MSN Hotmail. 
http://www.hotmail.com/sv


  Return to Index