Js图片特效:图片幻灯片切换

时间:2022-11-30 12:28:25

Js图片特效:图片幻灯片切换的代码如下:

<!--焦点图开始 电脑编程网-->
<script type="text/javascript" src="/js/pic.js"></script>
<script language="javascript" type="text/javascript">Maxz_LoadImg('322','238');</script>
<!--焦点图结束 http://www.pc123.org-->

放到网页上要显示的地方,Maxz_LoadImg 可以调整图片的大小,感觉好像还是等比例缩放的那种。

pic.js原代码:

function Maxz_LoadImg(w,h){
document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="object_flash_player" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="'+w+'" height="'+h+'"><param name="movie" value="/images/pic.swf"><param name="quality" value="high"><param name="allowScriptAccess" value="always"><param name="allowFullScreen" value="true"><param name="FlashVars" value="bcastr_xml_url=/js/pic.xml"><embed src="/images/pic.swf" flashvars="bcastr_xml_url=/js/pic.xml" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" allowfullscreen="true" width="'+w+'" height="'+h+'"></object>');
}
function selectTag(showContent,selfObj){
var tag = document.getElementById("tags").getElementsByTagName("li");
var taglength = tag.length;
for(i=0; i<taglength; i++){
tag[i].className = "";
}
selfObj.parentNode.className = "selectTag";
for(i=0; j=document.getElementById("tagContent"+i); i++){
j.style.display = "none";
}
document.getElementById(showContent).style.display = "block";
}

pic.xml存放的是图片的路径和链接址,

<?xml version="1.0" encoding="utf-8" ?> onclick="return false" href="http://www.nr234.cn/js/pic.xml#">- <bcaster config="2|0xffffff|0x000000|80|0xffffff|0x0099ff|0x000000"> <item item_url="http://www.dwww.cn/upfiles/2008-1/200811711475387151.jpg" link="/article/2008-1/2008117114753435.shtml" /> <item item_url="http://www.dwww.cn/upfiles/2008-1/200811620553657135.jpg" link="/article/2008-1/2008116205536427_1.shtml" /> <item item_url="http://www.dwww.cn/upfiles/2008-1/200811520353070043.jpg" link="/article/2008-1/2008115203530416_1.shtml" /> <item item_url="http://www.dwww.cn/upfiles/2008-1/20081159442029568.jpg" link="/article/2008-1/200811594420415.shtml" /> <item item_url="http://www.dwww.cn/upfiles/2008-1/200811120462820073.jpg" link="/article/2008-1/2008111204629404.shtml" /> </bcaster>

pic.swf就是在网页中显示的flash文件了。

用的时候别忘记把 http://www.nr234.cn/images/pic.swf 下载下来。。