怎样让两张图片在一个位置交替出现?求代码
1个回答
展开全部
专程找开软件写了个。。。不懂 在hi 我。。。。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>01</title>
<style type="text/css">
#demo img{
display:none
}
</style>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script type="text/javascript">
$(function(){
var i=0
var z=2; //图片总数
var demo=$("#demo img");
setInterval(function(){
if(i==z){i=0}
demo.eq(i).fadeIn().siblings().hide();
i++;
},1000)
});
</script>
</head>
<body>
<div id="demo">
<img src="http://www.google.com.hk/intl/zh-CN/images/logo_cn.png" />
<img src="http://www.ladymr.com/uploads/200912/20091224165844725_lit-lp.jpg" />
</div>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>01</title>
<style type="text/css">
#demo img{
display:none
}
</style>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script type="text/javascript">
$(function(){
var i=0
var z=2; //图片总数
var demo=$("#demo img");
setInterval(function(){
if(i==z){i=0}
demo.eq(i).fadeIn().siblings().hide();
i++;
},1000)
});
</script>
</head>
<body>
<div id="demo">
<img src="http://www.google.com.hk/intl/zh-CN/images/logo_cn.png" />
<img src="http://www.ladymr.com/uploads/200912/20091224165844725_lit-lp.jpg" />
</div>
</body>
</html>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询