correct array reference syntax

Discussion in 'JavaScript' started by cesarcesar, Oct 21, 2007.

  1. #1
    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[]*
    <input type="text" id="example[]" name="example[]" value="" onfocus="if(self.gfPop)gfPop.fPopCalendar(this);return false;">
    Code (markup):
    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*
    onclick="if(self.gfPop)gfPop.fPopCalendar(document.this_form.elements['example[]']);return false;"
    
    onclick="if(self.gfPop)gfPop.fPopCalendar(document.this_form.example[]);return false;"
    
    onclick="if(self.gfPop)gfPop.fPopCalendar(this);return false;"
    
    
    Code (markup):
     
    cesarcesar, Oct 21, 2007 IP