• 0

Targetting multiple iframes with one link


Question

Hi folks..

Having a little trouble with a site im working on at the moment,

On the main html page i have a series of links. Also on the main page i have 2 iframes. What i want to happen is that when one of these links is clicked a different page will appear in each iframe.

I'm assuming I can either do this straight from the link or by using some JScript as one of the pages is loading, but i cant for the life of me figure it out.

Any help would be great.

--WeeJames

3 answers to this question

Recommended Posts

  • 0

Hello, doing somthing like this might work:

With javascript multiple targets are possible.

Here's a simple case, with just two target iframes names numberOneiframe and numberTwoiframe:

function doTwo(pageA,pageB) 
{ 
(numberOneiframe.location=pageA); 
(numberTwoiframe.location=pageB); 
}

And the script for the link:

<a href="javascript:doTwo('page1.html','page2.html')">Change Two iframes</a>

That one link should load page1.html into numberOneiframe and load page2.html into numberTwoiframe.

  • 0

i think the code you'll want for it to work in all browsers is:

iframe code:

<iframe name="iframe1" src="..." id="iframe1"></iframe>

js code:

function iFrame_src(url) {

frames['iframe1'].location.href = url;

}

link code:

<a href="java script:iFrame_src('another_page.html');">

obviosly this can work with multiple frames of different names

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • The first link on the github page gives me a very, very red page warning me about phishing........
    • Hey Nick! 👋 No worries at all — you're not alone in this, and it's great you're asking for help. Let me walk you through a simple, step-by-step fix using the tool mentioned on that AOMEI Partition Assistant guide — it really does the trick for many people with this exact issue! ✅ Here’s how to restore your USB back to full 256GB on Windows 11: Download & Install AOMEI Partition Assistant Go to the link you shared: AOMEI Partition Assistant and click the Download Freeware button. Insert your USB stick (Sandisk Ultra 256GB) Make sure it's properly connected. Wait for the system to detect it. Launch AOMEI Partition Assistant Once open, you'll see all your connected drives listed. Locate your USB Drive Look for the one that says something like Disk X – Removable and shows only 3.1GB or so. Right-click on your USB Drive’s Partition Then select Delete Partition → confirm the deletion. Now, right-click on the unallocated space (it should now show full unallocated capacity) Choose Create Partition → format it as FAT32 or exFAT (recommended for larger drives) → click OK. Click “Apply” in the top left corner Then hit Proceed to execute the pending operations. Wait a bit... and boom! 🎉 Your USB should now be restored to its full 256GB capacity!
    • When Facebook bought Beat Saber, they promised exactly this would never happen. Facebook can’t not lie.
    • Depends on what you mean by "this data". Nvidia can show you quite a few of those as well in their performance overlay, and I guess they might've assumed that if anyone wants to see more, they'll just use Afterburner as the de facto standard. As for real framerate vs framegen framerate, I don't think they exactly want you to know, given that their marketing has been strongly focused on hiding the real framerate and pretending the generated one is all that matters...
  • Recent Achievements

    • First Post
      Fuzz_c earned a badge
      First Post
    • First Post
      TIGOSS earned a badge
      First Post
    • Week One Done
      slackerzz earned a badge
      Week One Done
    • Week One Done
      vivetool earned a badge
      Week One Done
    • Reacting Well
      pnajbar earned a badge
      Reacting Well
  • Popular Contributors

    1. 1
      +primortal
      713
    2. 2
      ATLien_0
      279
    3. 3
      Michael Scrip
      209
    4. 4
      +FloatingFatMan
      201
    5. 5
      Steven P.
      131
  • Tell a friend

    Love Neowin? Tell a friend!