Click to See Complete Forum and Search --> : JavaScript with Navigation in Frames


drew222
04-08-2003, 11:00 AM
Hi there

I have an application that uses two(2) frames. The top frame (called nav) contains the main navigation links for the application. The bottom frame (called main) is where the user would interact with the different forms.

The nav frame links to a pop-up window that contains all the different menu items for that category (which are all hyperlinks with a target of main). A user would then select on of the items and the pop-up is suppose to disappear while the form is displayed in frame 'main'.

This all works fine expect in the Netscape/Mozilla browsers. I have been working on figuring how to get this to work. In the pop-up menu, I have a <a href> statement with target=main and onClick="window.close()".

Unfortunately, the onClick event takes precendent over the actual link. I have tried a multitude of different things such as having the form do a window.opener.close() and also having a javascript in the pop-up menu that does a location and window.close() all to no avail. In both cases, the location portion works and window remains or the window disappears and there is no location function being executed.

Anyone have any suggestions on how to get this to work.

Thanks,
Drew Nathanson
drew@technicalsynergy.com

Nevermore
04-08-2003, 11:51 AM
Seems to work in IE6 - what browser are you having problems with? Try adding return=true .

drew222
04-08-2003, 12:41 PM
I know it works in IE. Actually, IE doesn't do it correctly. It needs to work in Netscape/Mozilla. I'm also not sure I understand your comment about return = true;

Nevermore
04-08-2003, 01:37 PM
I haven't tried it, but: onclick="window.open; return=true;" might work.

drew222
04-08-2003, 02:28 PM
Okay, I don't even know what you are trying to say here. I'm trying to get a window to close that was created in a frame. The onClick event on an Anchor has higher precedent then the actual link. See example below:

Frame 1 (called nav)

<script>
function OpenMenu()
{
newWin = window.open('Menu.html');

}
</script>

<a href="JavaScript:OpenMenu()">Test</a>

Menu.html:

<a href="Sample.html" target="main" onClick="window.close()">Menu Item 1</a>


Frame 2 (called main)

Receive the page Sample.html

Once the pop-up page (Menu.html) is display and the user selects the hyperlink, I want the current pop-up to disappear. It works fine in IE but will not work in Netscape/Mozilla.

Any suggestions?
Drew Nathanson

Nevermore
04-09-2003, 04:29 AM
Try changind <a href="Sample.html" target="main" onClick="window.close()">Menu Item 1</a>
to <a href="Sample.html" target="main" onClick="window.close(); return=true;">Menu Item 1</a>

drew222
04-09-2003, 06:35 AM
I will certainly try that. I'm not sure exactly what that will do in relation to having the link get process. Can you tell why this should work or what it is suppose to do?

Thanks,
Drew Nathanson

drew222
04-11-2003, 07:40 AM
cijori,
Thanks for the tip. However, this still doesn't work. Any other suggestions as to how to make this work?

Thanks,
Drew Nathanson

drew222
04-13-2003, 11:02 AM
Hey cjori,

Any other thoughts in this. I have tried a lot of different things and still can't find the right combination to make it work in Netscape/Mozilla.

Thanks for any help to this problem,
Drew Nathanson

Nevermore
04-13-2003, 11:05 AM
I'll try to find something.