2012-12-27 48 views

回答

0

試試這個

$('.screenID a').each(function(){ 
    var link = $(this).attr('href'); 
    $(this).attr('href',link.replace('../','http://www.aaa.com/')); 
}); 
0
$(".screenID").find("a").each(function(){ 
    var hrefReplace = $(this).attr("href"); 
    $(this).attr("href",hrefReplace.replace("../","http://www.aaa.com/")); 
}); 
2

這是最簡單的事情,可以工作(如果這太有限,您可能想使用RegExp匹配)

$(".screenId a").each(function(i,anchor){  
    anchor.href = anchor.href.replace(window.location.hostname,"www.aaa.com")})