![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hello all, As a beginner in Javascript I am trying to set focus to a form field which name is an array. The regular way to set focus I found: document.form.field.focus() The problem is now that the field is not a string but an array. JS is a bit confusing to me with its arrays, since you can print them out so easily. Here is an excerpt from the source code (generated via PHP): ----- input type="hidden" name="varnames[]" value="pid" / Enter Individual ID:</td td class="optionbox"><input type="text" name="vars[pid]" id="pid" value="I1" style="direction: ltr;" / input type="hidden" name="type[pid]" value="INDI" /> <a href="javascript: Find ID" onclick="iopenfind(document.setupreport.pid); return false;">Find ID</a></td></tr script language="JavaScript" type="text/javascript" document.setupreport.vars['pid'].focus(); /script ----- This gives me the following message: Error: document.setupreport.vars has no properties My question is now: How do I set focus to the field vars[pid]? |
![]() |
| Thread Tools | |
| Display Modes | |
| |