Results 1 to 6 of 6

Thread: Daily iframe content II not enough days

  1. #1
    Join Date
    Dec 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Daily iframe content II not enough days

    1) Script Title: Daily iframe content II

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...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.
    Last edited by nuncio2; 12-17-2007 at 07:25 PM. Reason: I made a cock-up

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    29,135
    Thanks
    44
    Thanked 3,231 Times in 3,192 Posts
    Blog Entries
    12

    Default

    Use this script:

    Code:
    <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.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Dec 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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
    Last edited by nuncio2; 12-18-2007 at 01:11 AM.

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    29,135
    Thanks
    44
    Thanked 3,231 Times in 3,192 Posts
    Blog Entries
    12

    Default

    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.
    Last edited by jscheuer1; 12-20-2007 at 08:53 AM. Reason: usage
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  5. #5
    Join Date
    Jun 2013
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default 365 htm files in sub-directory?

    Quote Originally Posted by jscheuer1 View Post
    Use this script:

    Code:
    <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!

  6. #6
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    29,135
    Thanks
    44
    Thanked 3,231 Times in 3,192 Posts
    Blog Entries
    12

    Default

    Sure! Say the sub-directory is called days, then just change this line:

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

    Code:
    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.
    Last edited by jscheuer1; 06-13-2013 at 09:31 AM.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •