我用JavaScript做了一个图片切换的效果 在火狐里正常显示 在IE里不显示...
发布网友
发布时间:2024-10-02 08:45
我来回答
共3个回答
热心网友
时间:2024-11-08 15:02
用document.write方法不可取,用下面类似的方法吧。希望对你有所帮助。
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> 图片加载完毕后自动轮换 </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="YangHui">
<META NAME="Keywords" CONTENT="YangHui">
<META NAME="Description" CONTENT="YangHui">
</HEAD>
<BODY>
<IMG name="animation" SRC="images/0.gif" WIDTH="180" HEIGHT="200" BORDER="0" ALT="晶莹">
<SCRIPT LANGUAGE="JavaScript">
<!--
var frame = 0;
var timeout_id = null;
function animate(){
document.animation.src = aniframes[frame].src;
if (frame == 3)
{
frame = 0;
} else{
frame = (frame + 1) % 10;
}
timeout_id = setTimeout("animate()", 500);
}
var aniframes = new Array(4);
var num_loaded_images = 0;
function countImages(){
if (++num_loaded_images == aniframes.length)
{
animate();
}
}
for (var i = 0; i < 4; i++)
{
aniframes[i] = new Image();
aniframes[i].onload = countImages;
aniframes[i].src = "images/" + i + ".gif";
}
//-->
</SCRIPT>
</BODY>
</HTML>
热心网友
时间:2024-11-08 15:04
你可以用css来连接图片,这样更容易找出错误所在
或者用上面那位大师的代码看看!
热心网友
时间:2024-11-08 15:09
你write出来的内容是下面这样的,我看不懂,你自己检查了
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/hotdeploy/flash/swflash.cab#version=6,0,0,0" width="577" height="319">
<param name="allowScriptAccess" value="sameDomain">
<param name="movie" value="focus2.swf">
<param name="quality" value="high">
<param name="bgcolor" value="#F0F0F0">
<param name="menu" value="false">
<param name=wmode value="opaque">
<param name="FlashVars" value="pics=includes/templates/classic/images/img01.jpg|includes/templates/classic/images/img02.jpg|includes/templates/classic/images/img03.jpg|includes/templates/classic/images/img04.jpg&links=Http%3A//baidu.com|Http%3A//baidu.com|Http%3A//baidu.com|Http%3A//baidu.com&texts=11|22|33|44&borderwidth=577&borderheight=319&textheight=0">
<embed src="includes/templates/classic/images/focus2.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="577" height="319" FlashVars="pics=includes/templates/classic/images/img01.jpg|includes/templates/classic/images/img02.jpg|includes/templates/classic/images/img03.jpg|includes/templates/classic/images/img04.jpg&links=Http%3A//baidu.com|Http%3A//baidu.com|Http%3A//baidu.com|Http%3A//baidu.com&texts=11|22|33|44&borderwidth=577&borderheight=319&textheight=0">
</embed>
</object>