Balakumar
Balakumar

Reputation: 131

how to change the iframe?

I have 2 iframes in my page. Both have the same source. When I change the 1st iframe, the changes must be reflected in 2nd one. It looks like remote browsing. How can I achieve this in javascript?

Upvotes: 0

Views: 62

Answers (2)

Joel Etherton
Joel Etherton

Reputation: 37533

If you're using jQuery:

var frames = $('iframe');
frames.each(function() {
    this.attr("src", yourUrl);
});

Upvotes: 0

Ryan
Ryan

Reputation: 5682

var iframes = document.getElementsByTagName('iframe');

var src = iframes[0].src;
iframes[1].src = src;

Without knowing what your page does or seeing any code can't really give you more then this...

Upvotes: 1

Related Questions