General discussion

Locked

window.open

By Shanghai Sam ·
I have written a menu in java script where the link takes you to a web address code as follows:
var MENU_ITEMS =[
["Sports & Leisure", null,
["Bowling clubs", "bowling"],
["Sports clubs", "sportsclubs"],
["Sports centres", window.open("http://www.wirral.gov.uk/ed/sports_centres.htm", "target" ) ],
["Parks", "http://www.wirral.gov.uk/er/"],
["Libraries", "http://www.wirral-libraries.net/" ]

],
I would like the window to open when the link is clicked and not when the index page is loaded of the site. How do I over come the problem?

Cheers

This conversation is currently closed to new comments.

3 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Try javascript:

by mningwani In reply to window.open

Instead of
window.open("http://www.wirral.gov.uk/ed/sports_centres.htm ", "target" )
try
"javascript:window.open('http://www.wirral.gov.uk/ed/sports_centres.htm ', 'target' )"

Collapse -

simple problem

by Nico_Baumgarten In reply to window.open

hi,

the problem lies here: when you create the array in each field it is put exactly what you tell javascript. in the problematic case its the return value of the window.open function - usually a window handle. you have two options to overcome this. first you place handling code for the procedure that is executing the link (as i am assuming that bowling and sportsclubs are no links but parameters for a handling function). The other option is to place the whole term in quotation marks - then it is simply a string. if you want to use it from whitin another script/function there should be a function that executes code within a string. You gotta check here for (eval, or exec - dont remember). the other option is to place it with a preceeding 'javascript:' in a HREF attribute of you link.

Have phun codin

Nico

Collapse -

Is this Tigraa Tree ?

by sreehari In reply to window.open

It seems you're using Tigraa Tree (www.softcomplex.com).

Your problem is not at all clear. Can you elaborate further on this ?

Sreehari.

Back to Web Development Forum
3 total posts (Page 1 of 1)  

Related Discussions

Related Forums