By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,317 Members | 1,265 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,317 IT Pros & Developers. It's quick & easy.

correct array reference syntax

100+
P: 162
I am using a js calendar script that populates a text field with a date. When clicking in the field the calendar shows then i choose a date, calendar closes, the date is now in the field. great it works fine.

example- *note, array use[]*
Expand|Select|Wrap|Line Numbers
  1. <input type="text" id="example[]" name="example[]" value="" onfocus="if(self.gfPop)gfPop.fPopCalendar(this);return false;">
I want to make this call from a button. when adding the code to a href, the popup shows but nothing happens when selecting a date. I have tried the following scripts will failure.

*html a href and img tag left out*
Expand|Select|Wrap|Line Numbers
  1. onclick="if(self.gfPop)gfPop.fPopCalendar(document.this_form.elements['example[]']);return false;"
  2.  
  3. onclick="if(self.gfPop)gfPop.fPopCalendar(document.this_form.example[]);return false;"
  4.  
  5. onclick="if(self.gfPop)gfPop.fPopCalendar(this);return false;"
  6.  
  7.  
Oct 22 '07 #1
Share this Question
Share on Google+
1 Reply


gits
Expert Mod 5K+
P: 5,390
hi ...

i'm not quite sure that an id called 'example[]' is an id that will work very properly ... but you may try to use:

Expand|Select|Wrap|Line Numbers
  1. document.getElementById('example[]');
  2.  
or:

Expand|Select|Wrap|Line Numbers
  1. document.getElementById('example\[\]');
  2.  
for your reference.

kind regards
Oct 22 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.