DHTML Menu Builder - Opening Links in a New Window

Note: In HTML Editor version 2009 and higher, the DHTML Menu Builder has been replaced with the CSS Menu Designer. To upgrade to the latest version of the HTML Editor, download it from your My Products page. For more information about the CSS Menu Designer, read How to Use the CSS Menu Designer.

We've fielded many requests from designers who want to know how to have their DHTML menu links open in a new browser window instead of the same window as the menu. Here's how to do it: Scroll down about halfway through the DHTML code until you see this:

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

Comment it out by putting two forward slashes in front of it (//). Next, add the following code to the very end of the line:

window.open(this.LinkTxt)

The finished product will look like this:

//this.LinkTxt.indexOf('javascript:')!=-1?eval(this.LinkTxt):DcLoc.location.href=this.LinkTxtwindow.open(this.LinkTxt)}}

Save your project, and you'll be all set.

Note: This method will cause all your links in the DHTML menu to open in a new window. Because of the way code works, you can't have some open in the current window and others in a new one — it's all or nothing.

Rate This Article

You must be signed in to rate articles.