Javascript opens new window and loads _self
This code loads the href into a new window and into self, why is this? Shouldn't return false; stop the de开发者_如何学Gofault click?
//get links in paragraphs
var first_p = $$('#client_work p a');
//get first link
var client_link = first_p[0];
if(client_link) {
$(client_link).observe('click', function() {
var mylink = window.open(client_link.href, 'new_window', '_self');
return false;
})
}
Try this
//get links in paragraphs
var first_p = $$('#client_work p a');
//get first link
var client_link = first_p[0];
if(client_link) {
$(client_link).observe('click', function(event) {
var mylink = window.open(client_link.href, 'new_window', '_self');
Event.stop(event);
})
}
精彩评论