a.other:link,a.other:visited,a.other:active
{
background:url("external.gif") no-repeat top right;
padding-right:15px;
}
<script type="text/javascript">
window.onload = function()
{
var aList = document.getElementsByTagName('a');
var iCount = aList.length;
for(var i = 0;i<iCount;i++)
{
if(!chkMyLink(aList[i].href,aList[i].innerHTML))
{
aList[i].className ='other';
}
}
}
//s是链接的url,innerhtml是链接文本
function chkMyLink(s,innerhtml)
{
if(innerhtml.replace( /^\s*/,"").match(/^\<img/gi)) return true;
var reg = /^http\:\/\//gi;
if(s.match(reg))
{
reg = /^http\:\/\/www.lemongtree.com/gi;
if(s.match(reg))
{
return true;
}
else
{
return false;
}
}
return true;
}
</script>