Forum Moderators: open

Message Too Old, No Replies

frameset confusion.... this ones a beauty

javascript, frames

         

michael auty

11:23 am on Nov 5, 2004 (gmt 0)

10+ Year Member



Hello all,

Ive struggled with this for hours last night and still can't fix it... It’s the only remaining problem with this current verison of my website code.

this is the site im talking about:
<SNIP>

The whole site is basically 1 big frameset that uses javascript links to call the correct frames in the folio section. just to be clear before i get into an explanation of the problem, the index.html and folio.html framesets are actually 2 seperate, static .html pages.

ok here goes.

There seems to be a problem with the javascript links opening the folio navigation in a new window rather than replacing the frames. It only happens when the user clicks into the portfolio section using the news item links from the home page.... To better explain it, try the following...

Example 1: Use the 'main navigation' to enter the following page: Folio / world wide web / 10associates --- everything works a-ok right?

Example 2: Now do the same thing but using the news link:
from the index page > Click the '10associates completed' news item > now click another category in the folio navigation e.g Print media... It opens in a new window! NOT what i want at all

The content frames that load are EXACTLY the same HTML files when navigating to the 10associates page using either of the examples above, except for one small detail which i am sure is at the root of the problem:

In example 1, the folio frameset replaces the index page when the folio link is clicked, > then the user selects 10 associates from the folio_navigation frameset which in turn replaces the two content frames.

In example 2, the news link replaces the index page with a static 10associates_sc.html frameset which contains the relevant content frames.

I just cannot work out why the same code (the same .html page in fact) would have two different effects?... and ive just noticed that Opera insists on opening ALL of the folio links in a separate tab, regardless of which navigation example you use. It's really driving me up the wall, and if worst comes to worst im going to disable the links from the news section.

any help here is greatly appreciated. booze, grade A narcotics and girls (or boys if you like) with loose morals are all available to the person able to help me with this one :D

Mike

[edited by: BlobFisk at 11:44 am (utc) on Nov. 5, 2004]
[edit reason] No URLs please! See TOS [webmasterworld.com] [/edit]

michael auty

2:17 pm on Nov 5, 2004 (gmt 0)

10+ Year Member



oh ok... seems a bit daft, but its my fault for not reading the toc...

the code im using to call the frames is

<tr>
<td class="folio_button"
onclick="window.open('frame1.html', 'frame1'); window.open('frame 2.html', 'frame2');"
onmouseover="this.style.backgroundColor='#FF00FF'; this.style.cursor='hand'; this.style.color='#FFFFFF';"
onmouseout="this.style.backgroundColor='#7C8088'; this.style.color='#CCCCCC';"><strong>world wide web </strong></td>
</tr>

this code is the same (as its the same .html file) whichever way you navigate to it...

im stuck... thanks in advance

michael auty

4:24 pm on Nov 5, 2004 (gmt 0)

10+ Year Member



** i edited this part of the post so that it actually makes sense, and inluded some html examples...**

in the folio section of my website, im using the following piece of code to load 3 frames in a frameset called folio.html:

<a href="#" onclick="window.open('10associates_frame1.html','10associates_frame1');
window.open('10associates_frame2.html','10associates_frame2');
window.open('10associates_frame3.html', '10associates_frame3');"> 10associates link </a>

theres nothing wrong here, it works a-ok, the correct content pages load in their correct frames...

however, if i use a different piece of code to navigate to a simliar frameset then when the main folio links are clicked, they do not open in the frames, but in seperate windows.

so, this new, example 2 code (which is a link made from a cell) is:

<tr>
<td colspan="4" class="news_body"
onClick="window.open('folio_www_supe_sc.html','_parent');"
onmouseover="this.style.backgroundColor='#FF00FF'; this.style.cursor='hand'; this.style.color='#FFFFFF';"
onmouseout="this.style.backgroundColor='#7C8088'; this.style.color='#CCCCCC';"> link text </td>
</tr>

this takes you to a new frameset that contains the code (same as example 1) but the code in example 1 now does not work correctly -

(note: using the 2nd example (link in a cell) does not take you to the same folio.html as before, but to a seperate file called folio_10associates.html which contains EXACTLY the same frames as folio.html)

im pretty sure its the window.open command in the first piece of code that is causing the problem, it cant be that theres something different about folio.html and folio_10associates.html as they contain exactly the same frames.

to make matters worse, the Opera browser seems to behave like the 2nd example all the time, opening ALL the folio links in a seperate window no matter which way you navigate into the folio section...

im thinking that this 'Opera' issue is telling me something and that im using the wrong syntax for the folio links. should i be using
window.location.href?
or
parent.location.href?
or
parent.frame.location.href?

its driving me insane! does anyone have any idea whats going on?

cheers v much for any help

Mike

[edited by: tedster at 6:41 pm (utc) on Nov. 5, 2004]
[edit reason] fix sidescroll [/edit]

tedster

2:00 am on Nov 6, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Here's a guess - something to experiment with. Do your two frameset documents give the individual frames identical name attributes? If so, try using different ones.

StupidScript

4:16 am on Nov 6, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi, Michael,

Try this on for size (page names plus page contents):

tdframe.html (open this in browser):

<frameset rows="*,*">
<frame src="tdtest2.html" id="top">
<frame src="tdtest.html" id="bottom">
</frameset>

tdtest.html:

<table><tr><td onclick="top.location.href='http://www.yahoo.com'">Go to Yahoo</td></tr></table>

tdtest2.html:

td test 2

POSSIBLY, if you prefer:

tdtest.html:

<table><tr><td onclick="parent.location.href='http://www.yahoo.com'">Go to Yahoo</td></tr></table>

OR, if you prefer:

tdtest.html:

<table><tr><td onclick="location.href='http://www.yahoo.com'">Go to Yahoo</td></tr></table>

OR, if you prefer:

tdtest.html:

<table><tr><td onclick="parent.frames[1].location.href='http://www.yahoo.com'">Go to Yahoo</td></tr></table>

Frame "top" is parent.frames[0]

OR, if you prefer:

tdtest.html:

<table><tr><td onclick="parent.frames['bottom'].location.href='http://www.yahoo.com'">Go to Yahoo</td></tr></table>

The Document Object Model (DOM) is the key. :)

michael auty

4:55 pm on Nov 6, 2004 (gmt 0)

10+ Year Member



tedster...

you may just have something there.... I would never even have considered that, will go off and play.

Thanks very much guys, you've given me something to work with now at least.

cheers, will post the results

Mike