Forum Moderators: open

Message Too Old, No Replies

div, iframe, css help

links to iframe don't work

         

electricocean

10:17 pm on Mar 15, 2005 (gmt 0)

10+ Year Member



Hi,
My site uses a css style sheet that isvertacally centeres <div>'s. Inside my <div>'s I have links linking to an Iframe inside another <div>. When the page is first loaded all the links work fine, but when you refresh the page or click the links too many times, the link target changes and it always opens the next in a new window.

whats wrong?

electricocean

tedster

12:07 am on Mar 16, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If there is no ID that matches the target attribute in the anchor tag, then the browser will open a new window and give it that name. So it sounds like the name or ID of the iframe is getting lost somehow after the initial load.

What is the html that intially establishes the iframe on the page? And what is the HTML for one of the misbehaving links?

If your domain name is in the code, just change it to example.com wherever it appears before you submit the post.

electricocean

11:45 pm on Mar 16, 2005 (gmt 0)

10+ Year Member



well here's the html of the links and the iframe:
<div class="left"><ul>
<li><a href="index2.htm" target="iframe">Home</a>
<li><a href="movies/index.htm" target="iframe">Movies</a>
<li><a href="about_us.htm" target="iframe">About Us</a>a<li><a href="http://www.examlple.org" target="_NEW">example.org</a></ul></div>
<div class="main">
<iframe src="index2.htm" name="iframe" width="460" height="332">Sorry, you browser does not support frames.</iframe>
</div>

*example.org is supposed to open in a new window

electricocean

tedster

3:55 am on Mar 17, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Two suggestions - not sure if they will help, but worth a try.

1. Don't use a special word, such as the actual name of an html element ('iframe'), to also name the element itself. It very well may be a protected word in some way and cause confusion when the browser's rendering code runs. Try almost anything else, such as name="main" or something like that.

2. Give the iframe both an ID attribute and a name attribute, and have them match.

So now we have <iframe id="main" name="main"> and target="main" for an attribute in the links.