Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4

Thread: iframe help

  1. #1
    New Coder
    Join Date
    May 2010
    Posts
    10
    Thanks
    3
    Thanked 0 Times in 0 Posts

    iframe help

    hi guys.

    im currently doing a college project and need some help!! so any help would be much appreciated!

    basically i have a set of styled links like below:

    Code:
    <div id="accountnav">
       <ul id="accountnavlist">
          <li><a href="1.php">Link 1</a></li>
          <li><a href="2.php">Link 2</a></li>
          <li><a href="3.php">Link 3</a></li>
          <li><a href="4.php">Link 4</a></li>
       </ul>
    </div>
    and when i click on one of them links, i want the page to open up in the iframe thats on the same page.

    i've done something similar using php before, but that was taking selections from a form, but this is taking it just from a link.

    again any help would be much appreictaed!!

    thanks!

  • #2
    Senior Coder
    Join Date
    Jun 2008
    Location
    New Jersey
    Posts
    2,536
    Thanks
    45
    Thanked 259 Times in 256 Posts
    This has nothing to do with PHP... you give your iframe a name, then you use the a tags's target attribute.

    So if the iframe has a name "testFrame", you give the link target="testFrame".

    But honestly, iframes are both out of fashion, as well as a general pain, for you as a programmer, and for people visiting the site. Regardless, that's how its done.

  • Users who have thanked Keleth for this post:

    lawler_09 (02-22-2011)

  • #3
    New Coder
    Join Date
    May 2010
    Posts
    10
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Keleth View Post
    This has nothing to do with PHP... you give your iframe a name, then you use the a tags's target attribute.

    So if the iframe has a name "testFrame", you give the link target="testFrame".

    But honestly, iframes are both out of fashion, as well as a general pain, for you as a programmer, and for people visiting the site. Regardless, that's how its done.
    thanks a lot for that, i realised just after id posted, *durrrrrrr*!!

    whats the better way to go about this now? for future reference!

    again much appreciated!

  • #4
    Senior Coder
    Join Date
    Jun 2008
    Location
    New Jersey
    Posts
    2,536
    Thanks
    45
    Thanked 259 Times in 256 Posts
    Having separate pages. The idea of iframes I think caught on because it looked like the same page, seemed like less load time... but it makes navigating (going back/forward) harder, it makes bookmarking impossible, and iframes act up in different browsers. Think about why you think you need an iframe, then consider, why bother? An iframe makes it appear as if you're on the same page, but has a load time... you could instead have your header/footer in their own files then include on each page. Thus, you get the exact same look on every page, with the same (well, ever so slightly slower) load time, but people can no navigate easily, they can bookmark pages they like, share specific content, etc.


  •  

    Posting Permissions

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