[thelist] a.b.variable.d

Matt Warden mwarden at gmail.com
Mon Mar 20 07:48:51 CST 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

john at johnallsopp.co.uk wrote:
> function addField(pType, pFormName, pSelectName)
> 
> {
> 
> 	newField = prompt ('New ' + pType);
> 
> 	// set up select
> 	ind = document.pFormName.pSelectName.selectedIndex;
> 	alert (ind);
>         // more stuff here
> 
> 	return newField;
> 
> }
> 
> Obviously the pFormName won't be interpreted, it looks for it as a
> literal.
> 
> I confess I'm not well practiced at ECMAScript, but I have looked
> through my notes and can't find the answer to this: How do I get it to
> look up the value that's been passed in?

document.forms[pFormname].elements[pSelectName].selectedIndex;


- --
Matt Warden
Miami University
Oxford, OH, USA
http://mattwarden.com


This email proudly and graciously contributes to entropy.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFEHrLCrI3LObhzHRMRAnEMAJ4+BdGEzDVQW1v4dBAgO7xzGgI6cACg4/bR
+slzTD3xZdsNfD7DXLqSW0k=
=Vrj4
-----END PGP SIGNATURE-----



More information about the thelist mailing list