为什么JAVASCRIPT里面PNG格式图片能显示而GIF格式的图片不能显示呢?
单独的话能显示<body><divstyle="position:absolute;left:124px;top:192px;z-index:1;"><imgsrc="t...
单独的话能显示
<body><div style="position:absolute;left:124px;top:192px;z-index:1;"><img src="tupian/images/interface/plantshadow32.png" style="position:absolute;left:72px;top:122px"> <img src="tupian\images\Zombies\Zombie/1.gif" style="position:absolute;left:10px;top:0px">;</div></body>
2.写到JAVASCRIPT里面就不能显示1.gif那张图片了?
<title>植物大战僵尸</title><style type="text/css"> *{margin:0px;padding:0px;font-family:"宋体";font-size:12px;} .WindowFrame{position:absolute;width:900px;height:600px;overflow:hidden;border:3px outset;}</style>
<script type="text/javascript"> window.onload = function(){ //背景显示,向右平移; var otg = document.getElementById("tGround"); otg.style.backgroundImage="url(tupian/images/interface/background1.jpg)"; otg.style.visibility = "visible"; var x=0; var timer = setInterval(function(){ x=x-20; otg.style.backgroundPosition = x+"px 0px"; if(x<=-500){ clearInterval(timer); //显示五个僵尸 var dZombie = document.getElementById("dZombie"); dZombie.style.left = (900 - 335) +"px"; var jx=document.createElement("div"); jx.style.position = "absolute"; jx.style.left = "124px"; jx.style.top = "192.px"; jx.zIndex = 1; jx.innerHTML = '<img src="tupian\images\Zombies\Zombie/1.gif">'; dZombie.appendChild(jx); } },30); };</script></head><body id="dBody" bgcolor="#008080"><!-- 主界面EDALL--> <div class="WindowFrame" id="dAll" style="position:absolute;top:0;width:900px;background:#000"><!--背景图片 --> <div style="position:absolute;width:1400px;height:600px;visibility:hidden;z-index:0" id="tGround"></div> <div style="position:absolute;width:335px;height:600px;left:1065px;top:0;z-index:1" id="dZombie"></div></div></body></html> 展开
<body><div style="position:absolute;left:124px;top:192px;z-index:1;"><img src="tupian/images/interface/plantshadow32.png" style="position:absolute;left:72px;top:122px"> <img src="tupian\images\Zombies\Zombie/1.gif" style="position:absolute;left:10px;top:0px">;</div></body>
2.写到JAVASCRIPT里面就不能显示1.gif那张图片了?
<title>植物大战僵尸</title><style type="text/css"> *{margin:0px;padding:0px;font-family:"宋体";font-size:12px;} .WindowFrame{position:absolute;width:900px;height:600px;overflow:hidden;border:3px outset;}</style>
<script type="text/javascript"> window.onload = function(){ //背景显示,向右平移; var otg = document.getElementById("tGround"); otg.style.backgroundImage="url(tupian/images/interface/background1.jpg)"; otg.style.visibility = "visible"; var x=0; var timer = setInterval(function(){ x=x-20; otg.style.backgroundPosition = x+"px 0px"; if(x<=-500){ clearInterval(timer); //显示五个僵尸 var dZombie = document.getElementById("dZombie"); dZombie.style.left = (900 - 335) +"px"; var jx=document.createElement("div"); jx.style.position = "absolute"; jx.style.left = "124px"; jx.style.top = "192.px"; jx.zIndex = 1; jx.innerHTML = '<img src="tupian\images\Zombies\Zombie/1.gif">'; dZombie.appendChild(jx); } },30); };</script></head><body id="dBody" bgcolor="#008080"><!-- 主界面EDALL--> <div class="WindowFrame" id="dAll" style="position:absolute;top:0;width:900px;background:#000"><!--背景图片 --> <div style="position:absolute;width:1400px;height:600px;visibility:hidden;z-index:0" id="tGround"></div> <div style="position:absolute;width:335px;height:600px;left:1065px;top:0;z-index:1" id="dZombie"></div></div></body></html> 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询