471,599 Members | 1,309 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,599 software developers and data experts.

How to target to an iFrame?

118 100+
Hi all,

I am doing an e-portfolio and as part of which I am saving the documents in pdf format. I have used a frameset with a topFrame and mainFrame.

There are links to documents in topFrame.html and an iFrame in mainFrame.html. What I was planning on doing was, when the user clicks the links in topFrame the link is opened in the iFrame (named and ID'd "frame" (rather than targetting to 'mainFrame' itself)).

The only problem is that the iFrame is on a different page to the links, even as part of the frameset. Would it be possible in HTML to target the links to 'frame'? Or should I be looking for a javascript solution?

Nov 2 '07 #1
1 2552
5,390 Expert Mod 4TB
hi ...

i think you have to use javascript for that, have a look at the following simple example, that shows you how to refer to specific frames with javascript:

<script type="text/javascript">
function load_in_iframe(url, frame_ref) {
frame_ref.location.href = url;
<iframe name="test1" src="http://www.google.com"></iframe>
<iframe name="test2" src="http://www.thescripts.com"></iframe>
<a href="#" onclick="load_in_iframe(frames.test2.location.href ,
load url of frame 2 to frame 1
kind regards
Nov 5 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by Federico Bari | last post: by
4 posts views Thread by DaveO | last post: by
36 posts views Thread by randau | last post: by
reply views Thread by Steve Richter | last post: by
7 posts views Thread by ukrbend | last post: by
reply views Thread by Anwar ali | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.