Untitled
By: a guest | Jun 29th, 2010 | Syntax:
JavaScript | Size: 1.10 KB | Hits: 279 | Expires: Never
<style>
a.shadow{background:#ccc;hide-focus:expression(this.hideFocus=true);outline:none;}
a.shadow img{border:#000 solid 1px;}
</style>
</head>
<body>
<a href="#" class="shadow"><img src="1.jpg" /></a>
</body>
<script>
(function(){
var shadow={
getclass:function(cls,callback){
var tag,that=this;
tag=document.getElementsByTagName('*');
that.each(tag,function(i){
if(tag[i].className==cls) callback(tag[i]);
});
},
each:function(ary,callback){
var i=0,that=this,add;
add=function(){
callback(i);
i++;
if(i<ary.length) setTimeout(add,1);
}
add();
},
find:function(ele,tagname,i){
return ele.getElementsByTagName(tagname)[i];
},
int:function(cls){
var that=this;
that.getclass(cls,function(ele,img){
var w=that.find(ele,'img',0).clientWidth;
var h=that.find(ele,'img',0).clientHeight;
that.find(ele,'img',0).style.cssText='position:absolute;top:-5px;left:-5px;'
ele.style.cssText='width:'+w+'px;height:'+h+'px;display:block;position:relative;';
});
}
};
shadow.int('shadow');
})()
</script>