tags:

views:

36

answers:

3

Here is some code I don't understand, but I know it opens the link in THE SAME WINDOW. I like it to open in BLANK NEW WINOWS... what to add/modify?

[some code before]
_.addEvent(b, 'click', function (e, i) {
document.location.href = (('undefined' !== typeof i) ? i: e.target).getAttribute('flickrshow-u')});_.addEvent(b, 'load', function (e, i) {
[some code after]

I tried to add e.target = "_blank"; before document, but no luck! I got this error: setting a property that has only a getter.

A: 

Rather than document.location.href, you need to use window.open to open a page in new window.

More Info:

Sarfraz
sorry, i read the link, but i dont know how to code it
marc-andre menard
+1  A: 

A URL assigned to document.location.href will open in the same window. If you pass this same url to window.open, it will open in a new window/tab.

You can read here about the different parameters window.open takes.

Oded
sorry, i read the link, but i dont know how to code it
marc-andre menard
@marc-andre Evidently you didn't read it carefully enough.
Josh Stodola
A: 

here is the code that work :

_.addEvent(b, 'click', function (e, i) { var linkk = (('undefined' !== typeof i) ? i: e.target).getAttribute('flickrshow-u');
                    window.open(linkk, "_blank");
marc-andre menard