网页图片旋转的特效代码 [ 网站地图 ]

发表于:2010-1-14 浏览:89 作者: 来源:互联网

关键字:网页图片,旋转,代码

描述:<!DOCTYPEHTMLPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html><head><title>tt</title><styletype="te

<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>
tt
</title>
<style type="text/css">
body{background:black}
#p1{position:absolute;height:75px;top:200px;}
</style>
<script type="text/javascript">
var left=200;
var img=document.getElementById(‘p1‘);
var imgWidth=286;
var pi=Math.PI;
var x=0,temp=0;
function init(){
document.getElementById(‘p1‘).style.left=left+‘px‘;
var set=setInterval(‘goOn()‘,40);
}
function goOn(){
temp=Math.cos(x);
document.getElementById(‘p1‘).style.width=Math.abs(imgWidth*temp)+‘px‘;
document.getElementById(‘p1‘).style.left=(left+(imgWidth-Math.abs(imgWidth*temp/2)))+‘px‘;
if(temp<0){
document.getElementById(‘p1‘).style.filter=‘FlipH(enabled:true)‘;
}else{
document.getElementById(‘p1‘).style.filter=‘FlipH(enabled:false)‘;
}
x+=pi/90;
}
</script>
</head>
<body >
<div id="imground">
<img id="p1" src="/images/logo.gif" alt="教学网"/>
</div>
<script type="text/javascript">init();</script>
</body>
</html>

站长资讯网 做中国最丰富的资讯网站 沪ICP备05004089号