Results 1 to 7 of 7

Thread: Need help with Iframe Linking

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

    Question Need help with Iframe Linking

    Ok, heres my situation. I will also add a picture to show you what I a talking about.



    OK, I am making a website for my cousins band. As you can see above that will be the basic lay out. There are 3 Iframes on the site Iframe 1 is where you see the welcome area, Iframe 2 is where it says "Test Are2" and Iframe 3 is where it says "Test Are 3".

    Now for the most part Iframe 2 and 3 will not be used, But only in their music section. Now what I would like to happen is this. Somone clicks the Mutimedia link from the main images. A list will appear in Iframe 2 (This I am able to already do). Now this is where my problem is. I want to make it so that when the person clicks the link from Iframe 2 that a page loads in Iframe 1 and also another page (completely differen't) loads in Iframe 3. I am just not sure how to code for this to happen.

    Basily I want to be able to open up 2 differen't pages in 2 differen't Iframes with 1 link. I have tried most of the coding tricks I know and none seem to work. I have searched the web and the best I have seen so far is using Java to do this (And that auther wasn't even sure it would work). So you know, I don't know anything about Java or Css or any thing along those lines. I know basic HTML and thats about it, so if anyone out that can help, please do so.

    Thank you in advance

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

    Default

    Well, you can use a function like the below:

    Code:
    function loadiframes(){
    document.getElementById("iframe1").src="http://google.com"
    document.getElementById("iframe2").src="http://cnn.com"
    document.getElementById("iframe3").src="http://msnbc.com"
    }
    where "iframe1", "iframe2" etc are the ID are the iframes in question. The above function when executed will load the various URLs into the iframes:

    Code:
    <a href="javascript:loadiframes()">Click here</a>

  3. #3
    Join Date
    Mar 2005
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Well thats my point. I know nothing about java. I don't know where to put any of that. Does it go in the header? The body? Do I have to make a java script for that?

    he 2nd part is easy as to where to put it, That actually goes before the text I want linked, but what about the rest?

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

    Default

    Simply wrap the first part (the function) inside the <script> tag, for example:

    <script>
    "
    "
    </script>

    and put it in the HEAD section of your page.

  5. #5
    Join Date
    Mar 2005
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Ok, but now comes a stupid question.

    I see how this code works, but how do I set it for more then 1 link? Like there are over 15 songs (links), Each song will have 1 page for lyrics and another page for the actual music. Do I use the <script> code for each?

  6. #6
    Join Date
    Mar 2005
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    OK, I have this in my head

    <head>
    <script>
    function loadiframes(){
    document.getElementById("main").src="BreakingDown.html"
    document.getElementById("main3").src="Play.html"
    }
    </script>


    And this is the done on the link

    <a href="javascript:loadiframes()">Breaking Down</a> <br />

    When open the page up in internet explore, and click the link it says this

    Error On Page

    In the status bar.

    what did I do wrong?

  7. #7
    Join Date
    Aug 2005
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question php form iframe

    Quote Originally Posted by JustSumNJguy
    OK, I have this in my head

    <head>
    <script>
    function loadiframes(){
    document.getElementById("main").src="BreakingDown.html"
    document.getElementById("main3").src="Play.html"
    }
    </script>


    And this is the done on the link

    <a href="javascript:loadiframes()">Breaking Down</a> <br />

    When open the page up in internet explore, and click the link it says this

    Error On Page

    In the status bar.

    what did I do wrong?
    I think this functions are great. But I need one more thing for it to work perfectly in my site.

    I have a form inside an iframe (iframe1), that when submitted, it validates a username and password. Besides, there is another iframe (iframe2) displaying "page1.php".

    Now, what I need is that if the user and password are correct, iframe2 should change to "page2.php".

    Hope you can help me. Thanks!

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
  •