Results 1 to 10 of 10

Thread: Monthly iFrame Content Script

  1. #1
    Join Date
    Dec 2012
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Monthly iFrame Content Script

    Hello

    Can anyone advise how I can modify the Daily iFrame Content Script

    http://www.dynamicdrive.com/dynamici...dowiframe2.htm

    So it becomes a Monthly Content Script (i.e. displays a message for a calendar month)

    Many Thanks

  2. #2
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    3,033
    Thanks
    25
    Thanked 599 Times in 575 Posts
    Blog Entries
    40

    Default

    Change;
    Code:
    var mytoday=mydate.getDate()
    to
    Code:
    var mytoday=mydate.getMonth()
    and start the page array from 0 (January is 0, December is 11)
    Code:
    daycontent[0]="january.htm"
    Focus on Function Web Design
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps

  3. #3
    Join Date
    Dec 2012
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Many Thanks, I'll give it a go

  4. #4
    Join Date
    Dec 2012
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Sorry - another question, is it possible to add a Forward and Backwards button so a visitor could look forward a month or back a month

    i.e. would something like

    backButton.onclick = function() {
    // do something
    }

    forwardButton.onclick = function() {
    //do something else
    }

    Work

    Thanks

  5. #5
    Join Date
    Dec 2012
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Just looking on the internet if I were to add the following

    iframe.contentWindow.history.go(-1); // back
    iframe.contentWindow.history.go(1); // forward

    Would this work for Buttons to take the Calendar Back or Forwards 1 month

    What I'm looking to achieve is a list of events for the current month but allow the visitor to go forward to the next month ot back one month

    any assistance appreciated

  6. #6
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    3,033
    Thanks
    25
    Thanked 599 Times in 575 Posts
    Blog Entries
    40

    Default

    history.go ... Would this work for Buttons to take the Calendar Back or Forwards 1 month
    No because history.go() is looking for page history stored in the browser, so if the month either side hasn't been viewed already, it wont be in the history to navigate to.

    A better approach would probably be to write a nextMonth() and prevMonth() function and then increment the numerical value of 'mytoday' when the appropriate button is clicked.
    Focus on Function Web Design
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps

  7. #7
    Join Date
    Dec 2012
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hello

    I have modified the script and placed the following in the page
    Code:
    <script type="text/javascript">
    
    /***********************************************
    * Daily iframe content II- (c) Dynamic Drive DHTML code library (www.dynamicdrive.com)
    * Please keep this notice intact
    * 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=380 height=175 marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="1" scrolling="auto"'
    
    //Specify 31 URLs to display inside iframe, one for each day of the current month
    //If this month has less than 31 days, the last few URLs won't be used.
    var monthcontent=new Array()
    monthcontent[0]="January.html"
    monthcontent[1]="February.html"
    monthcontent[2]="March.html"
    monthcontent[3]="April.html"
    monthcontent[4]="May.html"
    monthcontent[5]="June.html"
    monthcontent[6]="July.html"
    monthcontent[7]="August.html"
    monthcontent[8]="September.html"
    monthcontent[9]="October.html"
    monthcontent[10]="November.html"
    monthcontent[11]="December.html"
    
    //No need to edit after here
    if (ie||dom)
    document.write('<iframe id="dynstuff" src="" '+iframeprops+'></iframe>')
    
    var mydate=new Date()
    var mytoday=mydate.getMonth()
    
    function dayofmonth_iframe(){
    if (ie||dom){
    var iframeobj=document.getElementById? document.getElementById("dynstuff") : document.all.dynstuff
    iframeobj.src=monthcontent[mytoday]
    }
    }
    
    window.onload=dayofmonth_iframe
    
    </script>
    I have created the files for the months, the Window appears but with no content
    Last edited by Beverleyh; 11-25-2015 at 12:36 PM. Reason: formatting

  8. #8
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    3,033
    Thanks
    25
    Thanked 599 Times in 575 Posts
    Blog Entries
    40

    Default

    The code you posted works fine here. Have you checked the file names for correct path and case-sensitivity? File extension correct?
    Focus on Function Web Design
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps

  9. #9
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    3,033
    Thanks
    25
    Thanked 599 Times in 575 Posts
    Blog Entries
    40

    Default

    Focus on Function Web Design
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps

  10. #10
    Join Date
    Dec 2012
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Many thanks

Similar Threads

  1. Iframe SSI script II - Force css onto iframe content
    By cretin in forum Dynamic Drive scripts help
    Replies: 9
    Last Post: 04-15-2008, 08:34 AM
  2. Iframe scrollbar color and Monthly iframe content
    By big-dog1965 in forum JavaScript
    Replies: 1
    Last Post: 09-12-2007, 07:04 AM
  3. External content in Dynamic Ajax Content or Iframe SSI script II
    By halabar in forum Dynamic Drive scripts help
    Replies: 0
    Last Post: 04-30-2007, 05:11 PM
  4. Monthly iFrame Content inside of another iFrame.
    By Styles2304 in forum Dynamic Drive scripts help
    Replies: 7
    Last Post: 12-30-2006, 06:37 PM
  5. Monthly rotation of images--seeking script
    By vrm in forum Dynamic Drive scripts help
    Replies: 3
    Last Post: 05-13-2006, 12:51 PM

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
  •