PDA

View Full Version : Daily iframe content II not enough days



nuncio2
12-17-2007, 06:44 PM
1) Script Title: Daily iframe content II

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/dowiframe2.htm

3) Describe problem: I like the script, but I woul dlike to have a whole years worth of days instead of just 31. Is it possible to tweak the script to do this.

Any help would be appreciated - truly.

jscheuer1
12-17-2007, 08:49 PM
Use this script:


<script type="text/javascript">

/***********************************************
* Daily iframe content II- Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/
//Specify IFRAME display attributes
var iframeprops='width=150 height=150 marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="1" scrolling="no"'

//No need to edit after here

if (document.all||document.getElementById)
document.write('<iframe id="dynstuff" src="" '+iframeprops+'></iframe>');

function dayofyear_iframe(){
if (document.all||document.getElementById){
var mydate=new Date();
var iframeobj=document.getElementById? document.getElementById("dynstuff") : document.all['dynstuff'];
iframeobj.src=(mydate.getMonth()+1)+'_'+mydate.getDate()+'.htm';
}
}

window.onload=dayofyear_iframe;

</script>

No need to list the pages. It will fetch a page for each day of each month with the name of:

1_1.htm

through:

12_31.htm

Just make sure you have a page for each date.

nuncio2
12-18-2007, 12:55 AM
John

You are a real star - that works a treat. You must get bored with newbies like me asking what are prob easy things to you, but I do appreciate your effort. This has made a big differance to my work load.

A real cheek I know, but how could I go about including an auto resize for the Iframe height.

Thank you!

Mark

jscheuer1
12-20-2007, 05:36 AM
I'm not much of a fan of resizing iframes, or any content for folks in the forums here because, (aside from the inherent problems with resizing an iframe cross browser based upon its content page) once you try to resize anything on a page, you involve the entire page. There must be room for expansion without unsightly distortion, and a layout that will allow contraction (some distortion will inevitably happen, as long as it looks OK, it's fine - some layouts will not permit contraction without huge blank areas). With iframes its worse, because the size must be gotten from the contained page, which itself can vary extremely across browsers if floats and/or absolute positioning are involved on the external page(s).

It can often become a huge project in teaching the basics of simple fluid HTML layouts, involving me in redesigning the page(s).

So, although it is possible, I'd rather not get into it here.

clockmd
06-13-2013, 02:43 AM
Use this script:


<script type="text/javascript">

/***********************************************
* Daily iframe content II- Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/
//Specify IFRAME display attributes
var iframeprops='width=150 height=150 marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="1" scrolling="no"'

//No need to edit after here

if (document.all||document.getElementById)
document.write('<iframe id="dynstuff" src="" '+iframeprops+'></iframe>');

function dayofyear_iframe(){
if (document.all||document.getElementById){
var mydate=new Date();
var iframeobj=document.getElementById? document.getElementById("dynstuff") : document.all['dynstuff'];
iframeobj.src=(mydate.getMonth()+1)+'_'+mydate.getDate()+'.htm';
}
}

window.onload=dayofyear_iframe;

</script>

No need to list the pages. It will fetch a page for each day of each month with the name of:

1_1.htm

through:

12_31.htm

Just make sure you have a page for each date.

Is it possible to point this script to a sub-directory for the daily htm files? Thanks!

jscheuer1
06-13-2013, 04:28 AM
Sure! Say the sub-directory is called days, then just change this line:


iframeobj.src=(mydate.getMonth()+1)+'_'+mydate.getDate()+'.htm';

to:


iframeobj.src='days/'+(mydate.getMonth()+1)+'_'+mydate.getDate()+'.htm';

However, since this is an old thread, I'm closing it.

If you or anyone has any questions about it, please start a new thread and refer back to this one.