• 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

    • It depends if they can market it to hipsters, then they might hold a niche.
    • No Man's Sky Beacon update overhauls settlements and player overseer duties by Pulasthi Ariyasinghe Hello Games is back with another major update to its sci-fi space survival game No Man's Sky. This time, it has targeted settlement systems. The title will now let players be overseers who manage settlements across multiple planets while also discovering towns run entirely by robotic lifeforms. Space-faring players can now be the overseers of four settlements across the universe, with the job being offered to them after completing a unique objective. "Govern your settlers wisely and invest in their infrastructure to enable each settlement to flourish, producing lucrative resources, and becoming an invaluable base of operations throughout your journey," explains the studio. Settlement management has also been completely reworked with this update. Hello Games says that players will now have more important construction and upgrade choices, as each building has its own calculated contribution to the happiness, population, and productivity of its settlement. These can benefit the player via a wide range of resource production options. Not only that, each settler will even have their own personalities, strengths, weaknesses, and skills that will change how they work in their community. Players can find these by simply talking to any settler they meet on a planet. When a citizen dispute comes up, the number of choices offered to the overseer has been increased as well. As for the robotic settlements, they can only be found by scanning planets with specialist technology. Once found, these Autophage settlements can be taken over as well, letting players be the overseer and take care of the scrap metal-built locals. Other additions to this update include Intel Xe Super Sampling (XeSS) upscaling tech support on PC, more voice types for player characters, better snapping when building structures, and cross-save support across all platforms. Don't forget that No Man's Sky will soon be arriving on a brand-new platform too. The title will be a day-one launch on the Nintendo Switch 2 on June 5. Find the complete patch notes for No Man's Sky 5.7 Beacon Update over here.
    • Eh. I think I'm more in favor of this not being a thing. One of the most useful things on Reddit is being able to see if the person posting is consistently who they say they are. Hiding posts just allows shitposters to hide.
  • Recent Achievements

    • Week One Done
      mywakehealth earned a badge
      Week One Done
    • Dedicated
      jbatch earned a badge
      Dedicated
    • Week One Done
      Leonard grant earned a badge
      Week One Done
    • One Month Later
      portacnb1 earned a badge
      One Month Later
    • Week One Done
      portacnb1 earned a badge
      Week One Done
  • Popular Contributors

    1. 1
      +primortal
      294
    2. 2
      snowy owl
      159
    3. 3
      +FloatingFatMan
      155
    4. 4
      ATLien_0
      140
    5. 5
      Xenon
      126
  • Tell a friend

    Love Neowin? Tell a friend!