views:

55

answers:

1
$(document).ready(function(){


$("a[href*='http://']:not([href*='"+location.hostname+"'])").attr("target","_blank");

$("a[target!='_blank'][target!='_top']").live('click', function(){
$("#actualcontent").html('<center><img src="/deltasite/uploads/smallloader.gif"></center>');

var url=$(this).attr("href")+'?jquery=1';

$("#actualcontent").load(url);


$("#nav").load('/delta/pack_files/other/nav.php?url=' +$(this).attr("href"));

window.location.hash=$(this).attr("href");
        return false;  
    });

});

For some reason, on one embedded page of the site, this seems to affect links and images with onclick attribute. Any idea why? (Even if their target is blank or top). It only seems to do it on one page, annoyingly.

Any ideas?

Thanks, Tom.

A: 

Try excluding images/links which have an onclick attribute, using a combination of the :not selector and the has attribute selector:

$("a[href*='http://']:not([href='foo']):not([onclick])").attr("target","_blank");

Demo: http://jsfiddle.net/HjYEX/2/

karim79
Nice idea, but still doesn't work
Tom