Сообщение от Magneto
|
var arayLink = document.getElementsByTagName('a'),
|
ай-ай-ай
var a = /jpg$/,
b, // current a
c = 0,
ie = !document.documentElement.addEventListener,
handler = function(e){
if (a.test( (event ? event.srcElement:e.target).href)) {
alert("содержит");
} else {
alert("нет");
}
}
while ( b = document.links[c++] )
ie ? b.attachEvent("onmouseover", handler ):b.addEventListener("mouseover",handler,false);
пример :
<a href="/mk" style="color:red">no jpg</a>
<a href="/lol.jpg" style="color:green">jpg</a>
<script>
var a = /jpg$/,
b, // current a
c = 0,
ie = !document.documentElement.addEventListener,
handler = function(e){
if (a.test( (event ? event.srcElement:e.target).href)) {
alert("содержит");
} else {
alert("нет");
}
}
while ( b = document.links[c++] )
ie ? b.attachEvent("onmouseover", handler ):b.addEventListener("mouseover",handler,false);
</script>