Solved

HierMenu URL in new window

Posted on 2000-03-24
5
158 Views
Last Modified: 2012-05-04
In the following Javascript code snippet, an array is created for an HierMenu (see http://www.webreference.com/dhtml/hiermenus ).  My question is in respect to the line "javascript:top.location='www.excite.com'".   When this menu item is chosen, then the URL will be displayed within the CURRENT browser window.  However, I would like to have the URL displayed in a NEW browser window, so that the original page is not lost, rather than in the current browser window.  Can this be done?


arMenu1 = new Array(
160,
"","",
"","",
"#3399FF","#55BBFF",
"#0000FF","#000088",
"Test 1","javascript:top.location='www.excite.com'",0,
"Test 2","http://www.yahoo.com/index.htm",0,
"Services","http://www.webreference.com/index2.html",0,
"About","http://www.webreference.com/about.html",0
)
0
Comment
Question by:Monroe406
5 Comments
 
LVL 2

Accepted Solution

by:
HolySpirit earned 50 total points
ID: 2656141
Monroe406,
Yes, this can be done, try this out :

use :
javascript:open('www.excite.com')
instead of
javascript
javascript:top.location='www.excite.com

- Holy Spirit
0
 
LVL 2

Expert Comment

by:HolySpirit
ID: 2656147
Monroe406,
Sorry,
the script should look like this :

javascript:open('http://www.excite.com');top.history.go(-1)

-- Holy Spirit
0
 
LVL 16

Expert Comment

by:maneshr
ID: 2656193
replace ...


javascript:top.location='www.excite.com'

with

javascript:window.open('www.excite.com,"MenuPopup")
0
 
LVL 10

Expert Comment

by:kollegov
ID: 2656230
javascript:window.open('http://www.excite.com','winName');

you can use any name as winName to
open NEW window. and than if selected again open in the same window..
(or create new one if was closes)

you als can use
'_blank' as name to open in NEW window, but in this case new window will be created each time when this one called.

0
 

Author Comment

by:Monroe406
ID: 2656865
OK, your answers were all correct, but I still have a problem.   I am trying to create a HTML page, using the Javascript above, on my Windows 98 ACTIVE DESKTOP.   In other words, rather than use a bitmap wallpaper, my desktop is a HTML page...with a Javascript hierMenu, using the code above.

The problem is...a new window does NOT pop up when the menu item corresponding to "javascript:window.open('http://www.excite.com','_blank')" is chosen from the menu.

Any ideas why?
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Avoid defining the variables in the global scope; trying to define them in a local function scope. Because:   • Look-up is performed every time a variable is accessed.   • Variables are resolved backwards from most specific to least specific scope…
In this article, we'll look how to sort an Array in JavaScript, including the more advanced techniques of sorting a collection of records either ascending or descending on two or more fields. Basic Sorting of Arrays First, let's look at the …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now