代码如下:
imgUrl1=图片的目标地址
imgtext1="图片名称"
imgLink1=地址
imgUrl2=
imgtext2=
imgLink2=
imgUrl3=
imgtext3=
imgLink3=
var focus_width=360
var focus_height=187
var text_height=18
var swf_height = focus_height+text_height
var pics=imgUrl1+"|"+imgUrl2+"|"+imgUrl3
var links=imgLink1+"|"+imgLink2+"|"+imgLink3
var texts=imgtext1+"|"+imgtext2+"|"+imgtext3
document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase= http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6?0?0?0 width="'+ focus_width +'" height="'+ swf_height +'">');
document.write('<param name="allowScriptAccess" value="sameDomain"><param name="movie" value="pic_focus.swf"><param name="quality" value="high"> <param name="bgcolor" value="#F0F0F0">');
document.write('<param name="menu" value="false"><param name=wmode value="opaque">');
document.write('<param name="FlashVars" value="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight=' +focus_height+'&textheight='+text_height+'">');
document.write('<embed src="pixviewer.swf" wmode="opaque" FlashVars="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight= '+focus_height+'&textheight='+text_height+'" menu="false" bgcolor="#F0F0F0" quality="high" width ="'+ focus_width +'" height="'+ focus_height +'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage=" http://www.macromedia.com/go/getflashplayer" />'); document.write('</object>');
.....
我写的代码是这样的
<!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>无标题文档</title>
</head>
<body>
<script language="javascript">
imgUrl1="C:/Documents and Settings/Administrator/桌面/image"
imgtext1="cssp1.jpg"
imgLink1="image/cssp1.jpg"
imgUrl2="C:/Documents and Settings/Administrator/桌面/image"
imgtext2="cssp2.jpg"
imgLink2="image/cssp2.jpg"
imgUrl3="C:/Documents and Settings/Administrator/桌面/image"
imgtext3="cssp3.jpg"
imgLink3="image/cssp3.jpg"
var focus_width=360
var focus_height=187
var text_height=18
var swf_height = focus_height+text_height
var pics=imgUrl1+"|"+imgUrl2+"|"+imgUrl3
var links=imgLink1+"|"+imgLink2+"|"+imgLink3
var texts=imgtext1+"|"+imgtext2+"|"+imgtext3
document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase= http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6?0?0?0 width="'+ focus_width +'" height="'+ swf_height +'">');
document.write('<param name="allowScriptAccess" value="sameDomain"><param name="movie" value="pic_focus.swf"><param name="quality" value="high"> <param name="bgcolor" value="#F0F0F0">');
document.write('<param name="menu" value="false"><param name=wmode value="opaque">');
document.write('<param name="FlashVars" value="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight=' +focus_height+'&textheight='+text_height+'">');
document.write('<embed src="pixviewer.swf" wmode="opaque" FlashVars="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight= '+focus_height+'&textheight='+text_height+'" menu="false" bgcolor="#F0F0F0" quality="high" width ="'+ focus_width +'" height="'+ focus_height +'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage=" http://www.macromedia.com/go/getflashplayer" />'); document.write('</object>');
</script>
</body>
</html>
页面没有出错,但是显示不了图片。。。是不是地址错了,目标地址和地址有什么区别吗。
<script>
//-----WNum 为图片宽度
//-----HNum 为图片高度
//-----TNum 为文字高度(可为空 ,即不显示)
function go_Img(WNum,HNum,TNum){
Go_Num=(imgUrl.length-1);key=0;adNum=0;theTimer='';
var C_lass;
var $=function $(str){return document.write(str);};
var C_ss="<style>";
C_ss=C_ss+"div{overflow:hidden;}";
C_ss=C_ss+".W_Ord{overflow;hidden;text-align:center;color:#F00;font-weight:bold;clear:both;width:"+WNum+"px;height:"+TNum+";background-color:#eee;}";
C_ss=C_ss+".Min_On{color:#fff;Float:right;background-color:#f00;cursor:pointer;width:30px;height:20px;padding-top:1px;border:1px solid #f60;text-align:center;font-weight:bold;border-left:1px solid #eee;border-right:1px solid #eee;margin-left:-1px;}";
C_ss=C_ss+".Min_Off{color:#fff;Float:right;cursor:pointer;width:30px;height:20px;padding-top:1px;border-left:1px solid #eee;border-right:1px solid #eee;margin-left:-1px;text-align:center;font-weight:bold;}";
C_ss=C_ss+"</style>";
$(C_ss);C_ss='';
$("<Div +WNum+"px;height:"+HNum+"px;border:1px solid #eee;'>");
$("<div +WNum+"px;height:"+HNum+"px;'><img +WNum+"px;height:"+HNum+"px;' src='"+imgUrl[1]+"' name=imgInit onclick=go_Url();></Div>");
$("<div class='Rig' +WNum+"px;height:20px;margin-top:-20px;'>");
for (var i=100;i>0 ;i=i-2){
$("<Div +i/2+");-moz-opacity:0."+i/20+";opacity: 0."+i/20+"; '> </Div>");
}
$("</Div>");
$("<Div class='Rig' +WNum+"px;height:"+HNum+"px;margin-top:-100px;'>");
for (var j=Go_Num;j>0 ;j--){
if (j==1){C_lass='Min_On';}else{C_lass='Min_Off';}
$("<Div Id='Min"+j+"' class='"+C_lass+"' onmouseover=nextAd("+j+");>"+imgWord[j]+"</Div>");
}
$("</Div>");
$("</Div>");
if (TNum && TNum!=''){
$("<Div Id='W_Ord' class='W_Ord'>"+imgWord[1]+"</Div>");
}
nextAd(1);
}
function nextAd(GetNum){
var O=function O(objid){return document.getElementById(objid);}
adNum=adNum%Go_Num;
adNum++ ;
if(GetNum!=undefined && GetNum!=0){adNum=GetNum;}
if(key==0){key=1;}
else if(document.all){
imgInit.filters.revealTrans.Transition=23;
imgInit.filters.revealTrans.apply();
imgInit.filters.revealTrans.play();
if (document.all.W_Ord!=undefined){document.all.W_Ord.innerHTML=imgWord[adNum];}
for (var i=1;i<(Go_Num+1);i++ ){O('Min'+i).className='Min_Off';}
O('Min'+adNum).className='Min_On';
}
document.images.imgInit.src=imgUrl[adNum];
if (GetNum==undefined){theTimer=setTimeout(nextAd, 6000);}
else{clearTimeout(theTimer);theTimer=setTimeout(nextAd, 6000);}
}
function go_Url(jumpTarget){
jumpUrl=imgLink[adNum];
jumpTarget='_blank'; //_blank
if (jumpUrl != ''){
if (jumpTarget != '')
window.open(jumpUrl,jumpTarget);
else
location.href=jumpUrl;
}
}
</script>
<script>
//-------建产数组
var imgUrl=new Array();
var imgLink=new Array();
var imgWord=new Array();
imgUrl[1]=' http://hfxhyy.35hf.cn/back/UpPic/8vzrlf5v1czut.jpg';
imgLink[1]=' http://hfxhyy.35hf.cn/Object.asp?StrId=20';
imgWord[1]='<img src= http://hfxhyy.35hf.cn/back/UpPic/8vzrlf5v1czut.jpg width=100 height=100 />';
imgUrl[2]=' http://hfxhyy.35hf.cn/back/UpPic/q6hxyzon6by4b.jpg';
imgLink[2]=' http://hfxhyy.35hf.cn/Object.asp?StrId=18';
imgWord[2]='<img src= http://hfxhyy.35hf.cn/back/UpPic/q6hxyzon6by4b.jpg width=100 height=100 />';
imgUrl[3]=' http://hfxhyy.35hf.cn/back/UpPic/kdiqte-0rune7.jpg';
imgLink[3]='/Object.asp?StrId=17';
imgWord[3]='<img src= http://hfxhyy.35hf.cn/back/UpPic/kdiqte-0rune7.jpg width=100 height=100 />';
imgUrl[4]=' http://hfxhyy.35hf.cn/back/UpPic/mrocr4k8v1f40.jpg';
imgLink[4]=' http://hfxhyy.35hf.cn/Object.asp?StrId=16';
imgWord[4]='<img src= http://hfxhyy.35hf.cn/back/UpPic/8vzrlf5v1czut.jpg width=100 height=100 />';
imgUrl[5]=' http://hfxhyy.35hf.cn/back/UpPic/rsba4jy1m7mf6.jpg';
imgLink[5]=' http://hfxhyy.35hf.cn/Object.asp?StrId=15';
imgWord[5]='<img src= http://hfxhyy.35hf.cn/back/UpPic/rsba4jy1m7mf6.jpg width=100 height=100 />';
imgUrl[6]=' http://hfxhyy.35hf.cn/back/UpPic/ttqnfeij7_d8p.jpg';
imgLink[6]=' http://hfxhyy.35hf.cn/Object.asp?StrId=14';
imgWord[6]='<img src= http://hfxhyy.35hf.cn/back/UpPic/ttqnfeij7_d8p.jpg width=100 height=100 />';
// 调用方法
go_Img(690,505,0); //-----------------------------调用方法
</script>
这个是js写的你可以改改
imgUrl1="C:/Documents and Settings/Administrator/桌面/image"---代表的是你的图片的位置
imgtext1="cssp1.jpg"---代表的是相应图片的文字显示
imgLink1="image/cssp1.jpg"---代表的是连接地址