實現圖片和flash的混合切換
<html>
<head>
<script language='javascript'>
function showitem(itemname,itemsrc,itemtype)
{
?this.itemname=itemname;
?this.itemsrc=itemsrc;
?this.itemtype=itemtype;
?
?this.play=showplay;
}
function showplay()
{
?if(this.itemtype=='img'){
??
?}else{
?
?}
}
function itemlist(){
this.item1=new showitem("item1","1.gif","img");
this.item2=new showitem("item2","pixviewer.swf","fla");
this.item3=new showitem("item3","2.gif","img");
this.item4=new showitem("item4","1.gif","img");
this.item5=new showitem("item5","2.gif","img");
this.size=5;
}
var mylist=new itemlist();
mysize=mylist.size;
count=1;
function change_item()
{
var myitem = mylist['item'+count];
var preitem ;
if(count>1){
?preitem = mylist['item'+(count-1)];
}else{
?preitem = mylist['item'+count];
}
if(myitem.itemtype=='img'){
?document.all('picdiv').style.backgroundImage='url('+preitem.itemsrc+')';
?
?document.pic.src=myitem.itemsrc;
?document.all('picdiv').style.display='';
?document.all('fladiv').style.display='none';
?pic.filters.revealTrans.Transition=6;
?pic.filters.item(0).apply()
?pic.style.visibility='visible'
?pic.filters.item(0).play()
?setTimeout("pic.style.visibility='hidden'",2000);
}else{?
?document.all('fladiv').style.backgroundImage='url('+preitem.itemsrc+')';
?
?document.all('picdiv').style.display='none';
?document.all('fladiv').style.display='';
?
}
count++;
if(count>mysize) count=1
tt=setTimeout('change_item()',2000)
}
?
</script>
</head>
<body onload="change_item();">
<table width="120" height="90"><tr><td>
<div id="picdiv" name="picdiv" width="120" height="90">
?<img src='1.gif' id="pic" name="pic" width="120" height="90"? style='visibility:hidden;filter:revealtrans(duration=2.0,transition=0)'>
?
</div>
<div id="fladiv" name="fladiv" style="display:''" width="120" height="90">
<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='/swflash.cab#version=6,0,0,0' width='120' height='90'>
??????? <param name=movie value='pixviewer.swf'>
??????? <param name=quality value=high>
??????? <embed src='pixviewer.swf' quality=high pluginspage=http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash type=application/x-shockwave-flash width='120' height='90'>
??????? </embed>
</object>
</div>
</td>
</tr>
</table>
</body>
</html>
posted on 2006-10-31 15:10 捕風 閱讀(392) 評論(0) 編輯 收藏 所屬分類: web 頁面開發