how do you use onClick to open an HTML document in the same window?

Kaido

Elite Member & Kitchen Overlord
Feb 14, 2004
51,579
7,248
136
Update: Problem solved by lozina, thanks!

I'm working on a site using frames. I have the navigation bar on the left and the content on the right. On one of the pages, I'm using a table as the navigation tool. I want to be able to click on a cell in the table and have it open the link, but not in a seperate window. Here's the code I'm currently using:

<td bgcolor="EBEBEB" onMouseOver="bgColor='FFCCCC'" onMouseOut="bgColor='EBEBEB'" onClick="window.open('../files/test.html');">

So, for this cell, it has a mouseover color effect, then when you click on it, it opens "test.html" in a seperate window. I want it to open the link in the same window. I've tried using this:

onClick="open('../files/test.html');">

but that didn't work. What's the code for open the link in the same window? TIA!
 

Kaido

Elite Member & Kitchen Overlord
Feb 14, 2004
51,579
7,248
136
Hmm, I've made *some* progress:

onClick="parent.location='../files/test.html'"

This opens the linked "test.html" file in the same window, but kills the navigational frame. Argg! :D
 

Thyme

Platinum Member
Nov 30, 2000
2,330
0
0
I don't use JS much, but what if you use the name of the frame instead of "parent"?
 

Kaido

Elite Member & Kitchen Overlord
Feb 14, 2004
51,579
7,248
136
Originally posted by: Thyme
I don't use JS much, but what if you use the name of the frame instead of "parent"?

Just tried it, no dice. Thanks for the idea though! I'm not much of a Javascript guy either, so we're both in the same boat lol.