DHTML Menu: Closing Source Window When Link Opens Page in New Wi

Home » Forums » Free DHTML Menu Builder » DHTML Menu: Closing Source Window When Link Opens Page in New Wi


Guest
4 posts

I'm a new CoffeeCup user, and I've gotten great help from these postings as I create a new menu for my site (www.ncanalysis.org). I haven't uploaded the menu yet, as I'd like to work out one more issue. I can now get the links to open in a new browser window, but the source window stays open, and I'd like it to close when the new window opens. Does anyone know how I can do this?

Thanks in advance for any help you can give me.

Sarah


Senior Advisor
3,144 posts

Sarah,

If you are using the free CoffeeCup DHTML Menu Builder, or the DHTML menu builder in the CoffeeCup HTML Editor, you don.t need to make any special changes. Clicking on a menu item will change the current browser window to the new page.

If I have misunderstood what you are trying to do, please elaborate and I will try again. Bill R.
First Baptist Church
Brighter Day Charities
Roberson Family


Guest
4 posts

Bill,

Thank you for your quick reply. I probably didn't give enough information. My site is built with frames, and when I first created the new menu in the left frame, clicking on a link opened the new page in the left frame. To fix this I used the following code change that I found at CoffeeCup:

Comment out:
this.LinkTxt.indexOf('javascript:')!=-1?eval
(this.LinkTxt):DcLoc.location.href=this.LinkTxt

Add:
window.open(this.LinkTxt)


The code for this section now looks like this:
<!--this.LinkTxt.indexOf('javascript:')!=-1?eval
(this.LinkTxt):DcLoc.location.href=this.LinkTxt-->
window.open(this.LinkTxt)}}

Now when I click on a link, a new window opens, but the original window stays open. There are times when that's useful, but I don't want that to be the default option, as visitors to the site may wind up with many open windows. What I want is for the original window to close when the new window opens. This is how the menu links on my site (www.ncanalysis.org) currently work, and I'm hoping the new menu can open new pages in the same way.

I hope I'm explaining this clearly.

Thank you again for your help.

Sarah T.


Senior Advisor
3,144 posts

Sarah,

Have you read the help files at http://www.coffeecup.com/free-dhtml/help/ and especially the file on using frames?

http://www.coffeecup.com/help/articles/ … ng-frames/

There are some specifc things you must do both with the menu and with the frames. Bill R.
First Baptist Church
Brighter Day Charities
Roberson Family


Guest
4 posts

Bill,

I read the help files that were still available but was unable to resolve the problem. Since then I've rebuilt my web pages without frames (which I'd been planning to do), and I'm having the same issue. If I open my home page and click on a link, the new page opens in a new window, but the home page remains open. If I then click on a link in the second page, the third page opens in a new window, but the home page and the second page also remain open.

The only changes I've made to the code generated by the the DHTML menu builder are:
1. The code change I noted above to get the links to open in a new window.
Comment out:
this.LinkTxt.indexOf('javascript:')!=-1?eval
(this.LinkTxt):DcLoc.location.href=this.LinkTxt

Add:
window.open(this.LinkTxt)

2. The change recommended for relative positioning.
TargetLoc='themenu'; // span id for relative positioning

Do you have any suggestions for what might be wrong or how to get a window to close when the new window opens?

Thanks,
Sarah



Senior Advisor
3,144 posts

Sarah,

Do you have the menu uploaded? If so, please post a link, and I will take a look to see if I can see what is happening. If not, you could create a test page and upload it so it could be tested online.

One thing to look for is the target= in your menu links. That is what it sounds like you are using, but without looking there may be other things happening. Bill R.
First Baptist Church
Brighter Day Charities
Roberson Family


Guest
4 posts

Bill,

Thank you again for your interest, suggestions, and willingness to look at the site. I thought it might be an issue with the target=, but as I wasn't able to resolve it, I went ahead and used a different software that was easier for me to implement. I appreciate all the help and good ideas I've gotten at CoffeeCup.

Sarah T.

Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.