2013-08-29 25 views

回答

-1

我会给你idea..Suppose要处理所有一个标签

HTML

<a href="http://site.com/index.php#comment">Link<a> 

的JavaScript

$('a').click(function(event){ 
event.preventDefault(); 
var url = $(this).attr('href'); 
var lastPart = url.split('#')[1]; 
if(lastPart=== 'comment') { 
//do something 
} else if(lastPart === 'post') { 
//do something 
} 
}); 
相关问题