inicio mail me! sindicaci;ón

Change style of exterior CSS super link with Javascript

Can have with Css attribute selector undertake controlling to linking a type optionally, if allow all exterior links,add a small icon to mark its are one exterior link.

But have corrupt practice with Css:

1, support FireFox to wait to support very good browser to Web standard only.

2, can judge a link only, cannot judge anchorage dot or Javascript. If encounter <a Href= "javascript:vOid(0);" > is helpless.

Here can combine Js to finish, write a style above all:

It is quotative content below:

A.other:lInk, a.other:vIsited, a.other:aCtive
{Background:uRl(”external.gif” ) No-repeat Top Right;Padding-right:15px;
}

Write a Js again, but the diversity that Js wants to consider a link, the Javascript that as above face mentions, anchorage dot. If be picture link, do not use a type.

It is quotative content below:

<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’;
}
}
}

/ / the Url that S is a link, innerhtml is link textFunction ChkMyLink(s, innerhtml)
{If(innerhtml.replace(/^\s*/ , "" ).match(/^\<img/gi)) Return True;Var Reg = /^http\:\/ \//gi;If(s.match(reg) )
{Reg = /^http\:\/ \/www.webjx.com/gi;If(s.match(reg) )
{Return True;
}Else
{Return False;
}
}Return True;
}
</script>

Can see the effect now.

Bookmark:Digg Del.icio.us Reddit

Leave a Comment