How to use onClick with an HTML document in the same window? [td bgcolor] [seperate window]

admin / July 20th, 2010/ Posted in Software / No Comments »

Q: Update: Problem solved by Guy, thanks!

Im working on a site with frames. I have the navigation bar on the left and content on the right. On one of the pages, I use a table when the navigation tool. I want to click on a table cell and have it open the link, but not in a separate window. Here is the code I am currently:

u003ctd bgcolor = “EBEBEB” onMouseOver = “bgcolor =” FFCCCC “Lost =” bgcolor = “EBEBEB” onClick = “window.open (. / Files / test.html” ) “u003e

So, this cell has a mouseover color effect, then when you click, open the” test.html “in a separate window. I want the link in the same window. I tried using this:

onClick = open (./ files / test.html ); “u003e

but that did not work. What is the code for the link open in same window? TIA!


Re:Originally posted by: guy
did you try : location.href = '../files/test.html' ?

Perfect! Thanks! :)


Re:did you try : location.href = '../files/test.html' ?

Re:Originally posted by: guy
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.


Re:I don't use JS much, but what if you use the name of the frame instead of "parent"?

Re: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


Related posts


Tags: ,

Leave a Reply

Name required

Mail (will not be published) required

Website