PDA

View Full Version : Daily iframe content II



Brian07002
06-24-2005, 03:34 AM
I am looking for a script similar to the Daily Iframe content II script. But the difference would be that it can work with Months of the Year instead of Days Of the Month.

So, instead of having 31 days...Just have 12 Months. So that A Page Or Just an image can be rotated for each month of the year.

Ex:

( Each month has it's own image / page..This would be great!! )



January
Febuary
March
April
May
June
July
August
September
October
November
December


-Brian

jscheuer1
06-24-2005, 08:27 AM
<script type="text/javascript">

/***********************************************
* Monthly iframe content II- Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use. Modified for Months by jscheuer1
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

var ie=document.all
var dom=document.getElementById

//Specify IFRAME display attributes
var iframeprops='width=150 height=150 marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="1" scrolling="no"'

//Specify 12 URLs to display inside iframe, one for each month of the year
var mnthcontent=new Array()
mnthcontent[1]="1.htm"
mnthcontent[2]="2.htm"
mnthcontent[3]="3.htm"
mnthcontent[4]="4.htm"
mnthcontent[5]="5.htm"
mnthcontent[6]="6.htm"
mnthcontent[7]="7.htm"
mnthcontent[8]="8.htm"
mnthcontent[9]="9.htm"
mnthcontent[10]="10.htm"
mnthcontent[11]="11.htm"
mnthcontent[12]="12.htm"


//No need to edit after here
if (ie||dom)
document.write('<iframe id="dynstuff" src="" '+iframeprops+'></iframe>')

var mydate=new Date()
var myMonth=mydate.getMonth()

function monthofyear_iframe(){
if (ie||dom){
var iframeobj=document.getElementById? document.getElementById("dynstuff") : document.all.dynstuff
iframeobj.src=mnthcontent[myMonth+1]
}
}

window.onload=monthofyear_iframe

</script>

sdzeltwanger
10-03-2008, 05:24 AM
ok, I have to admit, this script is exactly what I was looking for, but I do have on small request, and hopefully someone will see this and get back to me shortly. I am using this script to display a monthly calendar that shows the current months activities when you go to that page, but is there any way for me to put a set of links under the calendar to switch to a previous month, next month and back to the current month?

Thanks, just wondering.

jscheuer1
10-03-2008, 07:23 AM
ok, I have to admit, this script is exactly what I was looking for, but I do have on small request, and hopefully someone will see this and get back to me shortly. I am using this script to display a monthly calendar that shows the current months activities when you go to that page, but is there any way for me to put a set of links under the calendar to switch to a previous month, next month and back to the current month?

Thanks, just wondering.

The way iframes work, it's like a small window in your page. I don't know what sort of calendar you are using. But if it already has links on it, those should work in the iframe. Otherwise, if you have the pages, each with a month on them, you could just make up links on those pages that would show in the iframe. Links in an iframe will load in that iframe.

sdzeltwanger
10-03-2008, 02:31 PM
ok, here's my page.
http://studentorgs.morris.umn.edu/parentpack/events.php

the calendars and the words "Previous Month" "Current Month" and "Next Month" are all in external files in the folder events/2008/

I understand what you were saying about the links in the iframe working in the iframe, but that helps and raises further questions.

I guess what I was trying to ask previously is if there is a script that I can use on the links that will change the month so that I don't have to edit the links every month?

The problem I have now is that I want to include clickable links in the calendar, but I don't want them to load in the iframe, is that possible, without having to have them load in a new window/tab?

jscheuer1
10-03-2008, 03:52 PM
You don't need to worry about that. You have 12 months, right? At the bottom of the October page, I see you have:


Previous Month Current Month Next Month

You don't need Current Month, it's already showing. The Next Month could be linked to:

november.htm

Previous Month to:

september.htm

These links would never have to change, similar ones (with the appropriate month's files as their href) could be links on each month's page. Then all you would need to do is to make your iframe tall enough, so that the links could be seen.

sdzeltwanger
10-03-2008, 04:54 PM
What I wanted to accomplish with the current month link was a one-click way back to the current month if I navigate forward or backwards a couple months. and the previous and next month links using a script of some sort would be easier for the site so that future web-admins will not have to worry about editing anything but the calendar contents each month. I also need the ability to switch years, so if I click on next month in December it will go to the January 2009 page.

And I am still trying to figure out how to open links inside the iframe outside the iframe.

jscheuer1
10-03-2008, 06:56 PM
Since I see you have PHP, you would probably be better off with something like:

http://www.k5n.us/webcalendar.php

You can also Google for other PHP based event calendars:

http://www.google.com/search?hl=en&q=php+event+calendar+script&aq=1&oq=PHP+event+c

However, to answer your questions. In HTML, you can target a link to an iframe or frame by its name. In javascript, one may use its number or name, or id (the syntax with id is different than with number or name).

A fairly simple function could determine current month based on the Date Object, and next and previous based upon the name of the page currently displayed. This function could be used to fetch next, previous or current month pages, as long as they were named with both month and year according some consistent convention.

But, you would run out of calendar pages if the user went too far forward or back. With a PHP calendar script, there would always be a calendar available. And it could even show recurring events (if any) as far into the future as anyone would care to look. And PHP would make the calendar, all that would need to be edited would be the events.