Results 1 to 2 of 2

Thread: Problem with dhtml modal window

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

    Default Problem with dhtml modal window

    1) Script Title: DHTML modal window

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...dhtmlmodal.htm

    3) Describe problem:
    Hi, I'm using the script above to display iframes.
    I would like to include a script in an IFRAME that would close this iframe automatically (do the same than : when you click on the cross), or reload the opener window.
    Can anyone help?

    Thanks

  2. #2
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    The docs on the script page actually already discusses how to do the first thing, that is, refresh the iframe automatically. Assuming the below is the HTML of your iframe page:

    <h4>Sign up for our newsletter!</h4>
    <form id="myform">
    <p>Enter your email address please:<br>
    <input id="emailfield" type="text" name="T1" size="30" />
    <input type="button" value="Ok" name="B1" onClick="parent.emailwindow.hide() " /></p>
    </form>

    Here the code in red creates a custom "Close button". To create code that auto closes the window after x seconds, you would change it to something like:

    Code:
    <script type="text/javascript">
    
    //Close window after 3 seconds
    setTimeout("parent.emailwindow.hide()", 3000)
    
    </script>
    To auto refresh the iframe after x seconds, do this instead:

    Code:
    <script type="text/javascript">
    
    //Refresh window after 3 seconds
    setTimeout("window.location.reload()", 3000)
    
    </script>
    Both of the above scripts need to go inside the iframe page.

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
  •