Re: JS refering to HTML/PHP arrays
| From: | Jason G. | Date: | Mon, 08 Oct 2001 23:24:25 +0000 |
| Subject: | Re: JS refering to HTML/PHP arrays | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-70397@lists.php.net to get a copy of this message | ||
First of all, Array[] is a reserved keyword, and I would recommend using something else.
Give each element an ID
<input type="text" name="myarray[name]" id="txtName">
In Javascript:
<script language="javascript">
alert(txtName.value);</script> -Jason Garber IonZoft.com At 05:07 PM 10/8/2001 +0000, you wrote:
Suppose I have these controls on a webpage: <input type="text" name="Array[name]"> <input type="text" name="Array[firstname]"> etc ... How can I refer to these fields in JavaScript? I've set my stuff up like this because it's easy to be able to pass all input as one variable, but now I'm stuck here. Thanks, Alexander. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net