| calendarxp Site Admin
 
 
 Joined: 30 Jan 2005
 Posts: 409
 
 
 | 
			
				|  Posted: Tue Feb 15, 2005 6:32 pm    Post subject: How to access the scripting objects of the containing page from within the plugins? |   |  
				| 
 |  
				| The build-in gContainer reference pointing to the enclosing window object is made for such purpose. Suppose you have a form named "testForm" with a <input> tag named "dateInput" laying in the same page as the calendar, and you want to put the selected date from the calendar into the "dateInput" field with the "y/m/d" date format, you should use the following code in plugins.js file: 
  	  | Code: |  	  | function fAfterSelected(y,m,d) { gContainer.document.testForm.dateInput.value=y+"/"+m+"/"+d;
 }
 | 
 
 Another example - if you opened a new window containing a FlatCalendar and wanted to send the selected date into a field in the original page, you can use the openerreference:
 
  	  | Code: |  	  | function fAfterSelected(y,m,d) { gContainer.opener.document.testForm.dateInput.value=y+"/"+m+"/"+d;
 }
 | 
 _________________
 Copyright 2003-2011 Idemfactor Solutions, Inc. All rights reserved.
 |  |