View previous topic :: View next topic |
Author |
Message |
lenkp
Joined: 03 Sep 2007 Posts: 3 Location: Maryland
|
Posted: Mon Sep 17, 2007 4:59 am Post subject: Trouble with many calendars on one page each using their own agenda |
|
|
I am having trouble placing many pop-up calendars on one web page each with its own agenda. The first calendar works fine, but the others seem to hiccup (e.g. not popup properly, fail to populate date field, fail to select default month/date, etc.) Enclosed are pictures and my code is below. I've tried making the NAME and ID attributes the same and different but nothing helps.
Any help would be much appreciated!
(I'm new to programming)
Thanks, paul
------BODY CODE----
<input name="my_date1" size="12" readonly="true" onFocus="this.blur()" value="click -->" maxlength="12">
<a href="javascript:void(0)"
onClick="if(self.gfPop)gfPop.fPopCalendar(my_date1);return false;" ><img name="popcal" align="absmiddle" src="images/calbtn.gif" width="34" height="22" border="0" alt="select single day or week # (preferred)" onMouseOver = "SetAgendaName('my_task1')"/>
(the above code is repeated for each task. each has its own unique date input field and SetAgendaName() parameter)
------HEAD FUNCTION CODE-------- selects a unique agenda based on the task
<script language="Javascript" type="text/javascript">
function SetAgendaName(task)
{
// id="gToday:normal:agenda.js:gfPop"
var agenda_name = 'gToday:normal:' + 'agenda_'+ task +'.js:gfPop';
var html = '<ifr'+'ame name='+'"'+agenda_name+'"' +' name="'+agenda_name+'"' +' src="ipopeng.htm" scrolling="no" frameborder="0" style="visibility:visible; z-index:999; position:absolute; top:-500px; left:-500px;"></ifr'+'ame>';
if (document.all)
document.body.insertAdjacentHTML('beforeEnd', html);
else {
var range = document.createRange();
range.setStartAfter(document.body.lastChild);
var docFrag = range.createContextualFragment(html);
document.body.appendChild(docFrag);
}
// alert(html);
}
</script>
(the first calendar uses the agenda_my_task1.js, the second calendar uses bob_task1.js, the third one uses john_task1.js, etc.)
|
|
Back to top |
|
|
calendarxp Site Admin
Joined: 30 Jan 2005 Posts: 409
|
Posted: Mon Sep 17, 2007 12:37 pm Post subject: |
|
|
Since you are using different agenda per calendar, you need to give them different context names, eg. gfPop1, gfPop2 ... and call the calendar accordingly with gfPop1.fPopCalendar(...), gfPop2.fPopCalendar(...) in the onclick event handler.
_________________ Copyright 2003-2011 Idemfactor Solutions, Inc. All rights reserved. |
|
Back to top |
|
|
lenkp
Joined: 03 Sep 2007 Posts: 3 Location: Maryland
|
Posted: Mon Sep 17, 2007 8:51 pm Post subject: re: Trouble with many calendars on one page each using their own agenda |
|
|
calendarxp wrote: | Since you are using different agenda per calendar, you need to give them different context names, eg. gfPop1, gfPop2 ... and call the calendar accordingly with gfPop1.fPopCalendar(...), gfPop2.fPopCalendar(...) in the onclick event handler. |
I tried your suggestion but now none of the calenders pop up. What do you suggest?
Thanks, paul
|
|
Back to top |
|
|
calendarxp Site Admin
Joined: 30 Jan 2005 Posts: 409
|
Posted: Mon Sep 17, 2007 11:00 pm Post subject: |
|
|
Do you have an online link for us to test? (You may PM me the link)
Also please check your page in Firefox and see if you got any errors in the "javascript console".
_________________ Copyright 2003-2011 Idemfactor Solutions, Inc. All rights reserved. |
|
Back to top |
|
|
calendarxp Site Admin
Joined: 30 Jan 2005 Posts: 409
|
Posted: Tue Sep 18, 2007 3:18 am Post subject: |
|
|
There is something you need to modify in the scripts:
Code: | <script language="Javascript" type="text/javascript">
function SetAgendaName(agenda)
{
// id="gToday:normal:agenda.js:gfPop"
var agenda_name = 'gToday:normal:' + 'agenda_'+ agenda +'.js:gfPop_'+agenda;
if (document.getElementById(agenda_name)!=null)
return; // because it's already created
// create calendar tag dynamically
var html = '<ifr'+'ame name='+'"'+agenda_name+'"' +' id="'+agenda_name+'"' +' src="ipopeng.htm" scrolling="no" frameborder="0" style="visibility:visible; z-index:999; position:absolute; top:-500px; left:-500px;"></ifr'+'ame>';
if (document.all)
document.body.insertAdjacentHTML('beforeEnd', html);
else {
var range = document.createRange();
range.setStartAfter(document.body.lastChild);
var docFrag = range.createContextualFragment(html);
document.body.appendChild(docFrag);
}
alert(html);
}
</script> |
Then you need to use "gfPop_<agenda_name>" to call fPopCalendar(). e.g. Code: | gfPop_safeway.fPopCalendar(...) |
_________________ Copyright 2003-2011 Idemfactor Solutions, Inc. All rights reserved. |
|
Back to top |
|
|
|