Results 1 to 3 of 3

Thread: I-Frame Help

  1. #1
    Join Date
    Apr 2006
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default I-Frame Help

    Script: IFrame SSI Script
    http://www.dynamicdrive.com/dynamici.../iframessi.htm

    My question is this: I want(ed) to use this script for the left menu of my school's website. The problem is this: when a link is clicked, it opens in the iframe area. Is there any way to open links in the iframe in the normal window? If so, how? If not, what could I do to accomplish this task a different way, without using php?

    Thanks

  2. #2
    Join Date
    Jul 2005
    Posts
    29
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    In the code for the link add the 'target=' value to the code. For example
    Code:
    <a href="page.html" target="main">Link</a>
    Assuming you want the content to load into another frame or iframe, use the name you have assigned to that frame.

  3. #3
    Join Date
    Apr 2006
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Not Quite

    To explain it in the easiest way, I have a page, index.htm, with an iframe on the left side of the page, menu.htm. Where in index.htm's code would I designate it as the main frame? Could you show me with an alternate color in the following code, or something similar?

    I put this in the head of my html:

    <script type="text/javascript">

    /***********************************************
    * IFrame SSI script- © Dynamic Drive DHTML code library (http://www.dynamicdrive.com)
    * Visit DynamicDrive.com for hundreds of original DHTML scripts
    * This notice must stay intact for legal use
    ***********************************************/

    //Input the IDs of the IFRAMES you wish to dynamically resize to match its content height:
    //Separate each ID with a comma. Examples: ["myframe1", "myframe2"] or ["myframe"] or [] for none:
    var iframeids=["myframe"]

    //Should script hide iframe from browsers that don't support this script (non IE5+/NS6+ browsers. Recommended):
    var iframehide="yes"

    var getFFVersion=navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1]
    var FFextraHeight=parseFloat(getFFVersion)>=0.1? 16 : 0 //extra height in px to add to iframe in FireFox 1.0+ browsers

    function dyniframesize() {
    var dyniframe=new Array()
    for (i=0; i<iframeids.length; i++){
    if (document.getElementById){ //begin resizing iframe procedure
    dyniframe[dyniframe.length] = document.getElementById(iframeids[i]);
    if (dyniframe[i] && !window.opera){
    dyniframe[i].style.display="block"
    if (dyniframe[i].contentDocument && dyniframe[i].contentDocument.body.offsetHeight) //ns6 syntax
    dyniframe[i].height = dyniframe[i].contentDocument.body.offsetHeight+FFextraHeight;
    else if (dyniframe[i].Document && dyniframe[i].Document.body.scrollHeight) //ie5+ syntax
    dyniframe[i].height = dyniframe[i].Document.body.scrollHeight;
    }
    }
    //reveal iframe for lower end browsers? (see var above):
    if ((document.all || document.getElementById) && iframehide=="no"){
    var tempobj=document.all? document.all[iframeids[i]] : document.getElementById(iframeids[i])
    tempobj.style.display="block"
    }
    }
    }

    if (window.addEventListener)
    window.addEventListener("load", dyniframesize, false)
    else if (window.attachEvent)
    window.attachEvent("onload", dyniframesize)
    else
    window.onload=dyniframesize

    </script>

    And I put this into the body:

    <iframe id="myframe" src="menu.htm" scrolling="no" marginwidth="0" marginheight="0" frameborder="0" vspace="0" hspace="0" style="overflow:visible; width:100%; display:none"></iframe>


    All help is greatly appreciated!!

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
  •