Sending a link from one iframe to another

K

KDawg44

Hi,

On my page i have 2 iframes. If a link is clicked in iframe2, i want
it to load the referenced page in iframe1. I tried target=iframe1 and
that does not seem to be working. Is there a way to do this or does
this only work from the parent page?

Thanks.
 
B

Benjamin Sattler

Hi!

Well, I tried it myself and it seems to work perfectly for me. Post
your code, maybe there's an error in it?

byebye

First post btw
 
K

KDawg44

Hi!

Well, I tried it myself and it seems to work perfectly for me. Post
your code, maybe there's an error in it?

byebye

First post btw

Here is the code to create the iframes:

<center><table cellspacing="0" cellpadding="0"
border="0"><tbody><tr><td>
<iframe id="videoFrame" marginwidth="0" marginheight="0"
src="videos.html" frameborder="0" width="221" scrolling="no"
height="206"></iframe>
</td></tr>
<tr><td>
<iframe id="videoListFrame" marginwidth="0" marginheight="0"
src="videoList.html" frameborder="0" width="221" scrolling="auto"
height="250"></iframe>
</td></tr></tbody></table></center>

And here is the code for the link.

output += '<a href="videos.html?file='
+ xmlDoc.getElementsByTagName('fileName')
.childNodes[0].nodeValue
+ '" target = "videoFrame"><font face = "verdana" size = "2" color
= "#FFFFFF">'
+ xmlDoc.getElementsByTagName('title').childNodes[0].nodeValue
+ '</a><br>\n<hr>\n';
}
document.getElementById('vids').innerHTML = output;
}

the links are created in a loop that takes filenames from an XML file.

Thanks for any insight. The link opens the file in a new window
everytime....
 
D

David Mark

Well, I tried it myself and it seems to work perfectly for me. Post
your code, maybe there's an error in it?

First post btw

Here is the code to create the iframes:

<center><table cellspacing="0" cellpadding="0"
border="0"><tbody><tr><td>
<iframe id="videoFrame" marginwidth="0" marginheight="0"
src="videos.html" frameborder="0" width="221" scrolling="no"
height="206"></iframe>
</td></tr>
<tr><td>
<iframe id="videoListFrame" marginwidth="0" marginheight="0"
src="videoList.html" frameborder="0" width="221" scrolling="auto"
height="250"></iframe>
</td></tr></tbody></table></center>

And here is the code for the link.

output += '<a href="videos.html?file='
+ xmlDoc.getElementsByTagName('fileName')
.childNodes[0].nodeValue
+ '" target = "videoFrame"><font face = "verdana" size = "2" color
= "#FFFFFF">'
+ xmlDoc.getElementsByTagName('title').childNodes[0].nodeValue
+ '</a><br>\n<hr>\n';
}
document.getElementById('vids').innerHTML = output;

}

the links are created in a loop that takes filenames from an XML file.

Thanks for any insight. The link opens the file in a new window
everytime....- Hide quoted text -

- Show quoted text -


I'd advise against using IFrame's for this as you don't need them and
they are more trouble than they are worth. In answer to your
question, you need name attributes on any frames you wish to target.
 
K

KDawg44

On Jul 13, 11:10 am, Benjamin Sattler <[email protected]>
wrote:
Here is the code to create the iframes:
<center><table cellspacing="0" cellpadding="0"
border="0"><tbody><tr><td>
<iframe id="videoFrame" marginwidth="0" marginheight="0"
src="videos.html" frameborder="0" width="221" scrolling="no"
height="206"></iframe>
</td></tr>
<tr><td>
<iframe id="videoListFrame" marginwidth="0" marginheight="0"
src="videoList.html" frameborder="0" width="221" scrolling="auto"
height="250"></iframe>
</td></tr></tbody></table></center>
And here is the code for the link.
output += '<a href="videos.html?file='
+ xmlDoc.getElementsByTagName('fileName')
.childNodes[0].nodeValue
+ '" target = "videoFrame"><font face = "verdana" size = "2" color
= "#FFFFFF">'
+ xmlDoc.getElementsByTagName('title').childNodes[0].nodeValue
+ '</a><br>\n<hr>\n';
}
document.getElementById('vids').innerHTML = output;

the links are created in a loop that takes filenames from an XML file.

Thanks for any insight. The link opens the file in a new window
everytime....- Hide quoted text -
- Show quoted text -

I'd advise against using IFrame's for this as you don't need them and
they are more trouble than they are worth. In answer to your
question, you need name attributes on any frames you wish to target.


Thanks. I will try that. I thought that ID replace NAME?

Thanks.
 
K

KDawg44

On Jul 13, 11:10 am, Benjamin Sattler <[email protected]>
wrote:
Here is the code to create the iframes:
<center><table cellspacing="0" cellpadding="0"
border="0"><tbody><tr><td>
<iframe id="videoFrame" marginwidth="0" marginheight="0"
src="videos.html" frameborder="0" width="221" scrolling="no"
height="206"></iframe>
</td></tr>
<tr><td>
<iframe id="videoListFrame" marginwidth="0" marginheight="0"
src="videoList.html" frameborder="0" width="221" scrolling="auto"
height="250"></iframe>
</td></tr></tbody></table></center>
And here is the code for the link.
output += '<a href="videos.html?file='
+ xmlDoc.getElementsByTagName('fileName')
.childNodes[0].nodeValue
+ '" target = "videoFrame"><font face = "verdana" size = "2" color
= "#FFFFFF">'
+ xmlDoc.getElementsByTagName('title').childNodes[0].nodeValue
+ '</a><br>\n<hr>\n';
}
document.getElementById('vids').innerHTML = output;

the links are created in a loop that takes filenames from an XML file.

Thanks for any insight. The link opens the file in a new window
everytime....- Hide quoted text -
- Show quoted text -

I'd advise against using IFrame's for this as you don't need them and
they are more trouble than they are worth. In answer to your
question, you need name attributes on any frames you wish to target.


That did the trick. THanks!
 
D

David Mark

On Jul 13, 11:10 am, Benjamin Sattler <[email protected]>
wrote:
Hi!
Well, I tried it myself and it seems to work perfectly for me. Post
your code, maybe there's an error in it?
byebye
First post btw
Hi,
On my page i have 2 iframes. If a link is clicked in iframe2, i
want it to load the referenced page in iframe1. I tried
target=iframe1 and that does not seem to be working. Is there a
way to do this or does this only work from the parent page?
Thanks.
Here is the code to create the iframes:
<center><table cellspacing="0" cellpadding="0"
border="0"><tbody><tr><td>
<iframe id="videoFrame" marginwidth="0" marginheight="0"
src="videos.html" frameborder="0" width="221" scrolling="no"
height="206"></iframe>
</td></tr>
<tr><td>
<iframe id="videoListFrame" marginwidth="0" marginheight="0"
src="videoList.html" frameborder="0" width="221" scrolling="auto"
height="250"></iframe>
</td></tr></tbody></table></center>
And here is the code for the link.
output += '<a href="videos.html?file='
+ xmlDoc.getElementsByTagName('fileName')
.childNodes[0].nodeValue
+ '" target = "videoFrame"><font face = "verdana" size = "2" color
= "#FFFFFF">'
+ xmlDoc.getElementsByTagName('title').childNodes[0].nodeValue
+ '</a><br>\n<hr>\n';
}
document.getElementById('vids').innerHTML = output;
}
the links are created in a loop that takes filenames from an XML file.
Thanks for any insight. The link opens the file in a new window
everytime....- Hide quoted text -
- Show quoted text -

I'd advise against using IFrame's for this as you don't need them and
they are more trouble than they are worth. In answer to your
question, you need name attributes on any frames you wish to target.

Thanks. I will try that. I thought that ID replace NAME?

Thanks.- Hide quoted text -

- Show quoted text -


It certainly did not replace name for frames. It didn't replace
anything really.

The name attribute has been deprecated in certain flavors of XHTML for
certain elements as the objects used with it (eg document.images,
document.forms, document.links) are not available when pages are
parsed as XML. It still exists for input elements as the elements
property still exists for form objects. Realize that they are not the
same as you can have multiple input elements with the same name (eg
radio buttons), but obviously they can't all have the same id.

The id attribute is used with document.getElementById and must be
unique for each element in the page. Looking up an iframe element by
id is not the same as looking it up by name in window.frames. The
former returns an element object, the latter a child window.
 
K

KDawg44

On Jul 13, 11:10 am, Benjamin Sattler <[email protected]>
wrote:
Hi!
Well, I tried it myself and it seems to work perfectly for me. Post
your code, maybe there's an error in it?
byebye
First post btw
Hi,
On my page i have 2 iframes. If a link is clicked in iframe2, i
want it to load the referenced page in iframe1. I tried
target=iframe1 and that does not seem to be working. Is there a
way to do this or does this only work from the parent page?
Thanks.
Here is the code to create the iframes:
<center><table cellspacing="0" cellpadding="0"
border="0"><tbody><tr><td>
<iframe id="videoFrame" marginwidth="0" marginheight="0"
src="videos.html" frameborder="0" width="221" scrolling="no"
height="206"></iframe>
</td></tr>
<tr><td>
<iframe id="videoListFrame" marginwidth="0" marginheight="0"
src="videoList.html" frameborder="0" width="221" scrolling="auto"
height="250"></iframe>
</td></tr></tbody></table></center>
And here is the code for the link.
output += '<a href="videos.html?file='
+ xmlDoc.getElementsByTagName('fileName')
.childNodes[0].nodeValue
+ '" target = "videoFrame"><font face = "verdana" size = "2" color
= "#FFFFFF">'
+ xmlDoc.getElementsByTagName('title').childNodes[0].nodeValue
+ '</a><br>\n<hr>\n';
}
document.getElementById('vids').innerHTML = output;
}
the links are created in a loop that takes filenames from an XML file.
Thanks for any insight. The link opens the file in a new window
everytime....- Hide quoted text -
- Show quoted text -
I'd advise against using IFrame's for this as you don't need them and
they are more trouble than they are worth. In answer to your
question, you need name attributes on any frames you wish to target.

Thanks. I will try that. I thought that ID replace NAME?
Thanks.- Hide quoted text -
- Show quoted text -

It certainly did not replace name for frames. It didn't replace
anything really.

The name attribute has been deprecated in certain flavors of XHTML for
certain elements as the objects used with it (eg document.images,
document.forms, document.links) are not available when pages are
parsed as XML. It still exists for input elements as the elements
property still exists for form objects. Realize that they are not the
same as you can have multiple input elements with the same name (eg
radio buttons), but obviously they can't all have the same id.

The id attribute is used with document.getElementById and must be
unique for each element in the page. Looking up an iframe element by
id is not the same as looking it up by name in window.frames. The
former returns an element object, the latter a child window.


Thank you very much for the explanation. I appreciate your time and
brain power. :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,159
Messages
2,570,879
Members
47,417
Latest member
DarrenGaun

Latest Threads

Top