Entry
How can I set the Form Name and the Field dynamically in a window.opener.document.[FormName].[Field]
Jun 2nd, 2008 17:58
forum net tr, cemal ates, cemal kemal, David Blackledge, Guillermo Cruz, http://www.forumnettr.com
For this specific question, there are arrays defined for exactly this
purpose:
var formname = "bob";
var fieldname = "fred";
var ref = window.opener.document.forms[formname].elements[fieldname];
However, it is good to know that JavaScript is designed such that ANY
property can be accessed using a string subscript like so:
var ref = window.opener.document[formname][fieldname]
or a more extreme example:
var ref =
window["opener"]["document"]["forms"][formname]["elements"][fieldname];
http://www.forumnettr.com
http://www.forumnettr.com/forum