Dreamweaver中有没有简便的方法可以做,只要图片可以自动变换且可以设链接就行。JS太麻烦了。
实在不行,有没有能解释下面网站中的代码如何换图片、链接、尺寸。
Dreamweaver中有没有简便的方法可以做,只要图片可以自动变换且可以设链接就行。JS太麻烦了。
实在不行,有没有能解释下面网站中的代码如何换图片、链接、尺寸。
<SCRIPT language="javascript" type="text/javascript">
//定义的图片地址
img1=new Image ();img1.src=' http://www.baidu.com/img/baidu_logo.gif';
img2=new Image ();img2.src=' http://www.google.cn/intl/zh-CN/images/logo_cn.gif';
img3=new Image ();img3.src=' http://misc.web.xunlei.com/www_5_1/img/index_newlogo.png';
img4=new Image ();img4.src=' http://i1.sinaimg.cn/home/deco/2009/0330/logo_home.gif';
img5=new Image ();img5.src=' http://img1.cache.netease.com/cnews/netease/logo_w.gif';
img6=new Image ();img6.src=' http://mat1.qq.com/www/iskin/skin4/expotclogo.gif';
//定义的图片链接地址
url1=new Image ();url1.src=' http://www.baidu.com/';
url2=new Image ();url2.src=' http://www.google.cn/';
url3=new Image ();url3.src=' http://www.xunlei.com/';
url4=new Image ();url4.src=' http://www.sina.com.cn/';
url5=new Image ();url5.src=' http://www.163.com/';
url6=new Image ();url6.src=' http://www.qq.com/';
//定义的图片名称
bti1=new Image ();bti1.name='百度';
bti2=new Image ();bti2.name='谷歌';
bti3=new Image ();bti3.name='迅雷';
bti4=new Image ();bti4.name='新浪';
bti5=new Image ();bti5.name='网易';
bti6=new Image ();bti6.name='腾讯';
//定义的图片宽度
w1=new Image ();w1.width='270';
w2=new Image ();w2.width='276';
w3=new Image ();w3.width='142';
w4=new Image ();w4.width='107';
w5=new Image ();w5.width='111';
w6=new Image ();w6.width='100';
//定义的图片高度
h1=new Image ();h1.height='129';
h2=new Image ();h2.height='110';
h3=new Image ();h3.height='48';
h4=new Image ();h4.height='43';
h5=new Image ();h5.height='36';
h6=new Image ();h6.height='45';
var widths=490;var heights=230;var counts=6;var ye=1;var ti=1;var speed=4000;//定义的ye值为1显示数字值为0不显示数字,ti值为1显示标题值为0不显示标题||||speed定义的是速度,counts定义的是图片的数量,和上面的数组个数要对应||||widths和heights是定义的整个框架的宽度和高度
var top;var nn=1;var key=0;var nnnn;
if((ti==1)&&(ye==1))
{top=32;}else{top=16};
function change_img()
{if(key==0){key=1;}
else if(document.all)
{document.getElementById("pic").filters[0].Apply();
document.getElementById("pic").filters[0].Play(duration=2);
document.getElementById("pic").filters[0].Transition=23;};
eval('document.getElementById("pic").src=img'+nn+'.src');
eval('document.getElementById("pic").width=w'+nn+'.width');
eval('document.getElementById("pic").height=h'+nn+'.height');
eval('document.getElementById("url").href=url'+nn+'.src');
if(ti==1){eval('nnnn=bti'+nn+'.name');
document.getElementById("yu").innerHTML='<b>'+nnnn+'<b>';}
if(ye==1){for (var i=1;i<=counts;i++)
{document.getElementById("xxjdjj"+i).className='axx';}
document.getElementById("xxjdjj"+nn).className='bxx';};nn++;if(nn>counts){nn=1;};tt=setTimeout('change_img()',speed);};
function changeimg(n){nn=n;window.clearInterval(tt);change_img();};
document.write('<style>');
document.write('.axx{padding:0px 7px 3px;*padding:1px 7px;border-left:#cccccc 1px solid;}');
document.write('a.axx:link,a.axx:visited{text-decoration:none;color:#fff;line-height:16px;font:12px sans-serif;background-color:#666;}');
document.write('a.axx:active,a.axx:hover{text-decoration:none;color:#fff;line-height:16px;font:12px sans-serif;background-color:#999;}');
document.write('.bxx{padding:0px 7px 3px;*padding:1px 7px;border-left:#cccccc 1px solid;}');
document.write('a.bxx:link,a.bxx:visited{text-decoration:none;color:#fff;line-height:16px;font:12px sans-serif;background-color:#D34600;}');
document.write('a.bxx:active,a.bxx:hover{text-decoration:none;color:#fff;line-height:16px;font:12px sans-serif;background-color:#D34600;}');
document.write('</style>');
document.write('<div style="width:'+widths+'px;height:'+heights+'px;overflow:hidden;text-overflow:clip;border:#f00 1px solid;">');
document.write('<div><a id="url"><img id="pic" style="border:0px;filter:progid:DXImageTransform.Microsoft.RevealTrans (duration=2,transition=23);" /></a></div>');
document.write('<div style="filter:alpha(style=1,opacity=30,finishOpacity=80);-moz-opacity:0.8; opacity:0.8;background: #888888;width:100%-2px;text-align:right;top:-'+top+'px;position:relative;margin:1px;height:24px;padding:0px;margin:0px;border:0px;');
if((ye==1)||(ti==1)){document.write('">');}
else{document.write('display:none;">');};
if(ti==1){document.write('<div id="yu" style="filter:alpha(style=1,opacity=100,finishOpacity=30);height:12px;text-align:center;color:#F00;background-color:#6F0;line-height:16px;"></div>');};
//id=yu的div是显示标题的
if(ye==1){for(var i=1;i<counts+1;i++){document.write('<a href="javascript:changeimg('+i+');" id="xxjdjj'+i+'" class="axx" target="_self">'+i+'</a>');}};document.write('</div></div>');
change_img();</SCRIPT>
要会写JAVASCRIPT脚本
会的话 非常容易实现 不然你去搜下JAVASCRIPT换图 一大堆代码
var top;var nn=1;var key=0;var nnnn; if((ti==1)&&(ye==1)) {top=32;}else{top=16}; function change_img() {if(key==0){key=1;} else if(document.all) {document.getElementById("pic").filters[0].Apply(); document.getElementById("pic").filters[0].Play(duration=2); document.getElementById("pic").filters[0].Transition=23;}; eval('document.getElementById("pic").src=img'+nn+'.src'); eval('document.getElementById("pic").width=w'+nn+'.width'); eval('document.getElementById("pic").height=h'+nn+'.height'); eval('document.getElementById("url").href=url'+nn+'.src');
if(ti==1){eval('nnnn=bti'+nn+'.name'); document.getElementById("yu").innerHTML='<b>'+nnnn+'<b>';} if(ye==1){for (var i=1;i<=counts;i++) {document.getElementById("xxjdjj"+i).className='axx';} document.getElementById("xxjdjj"+nn).className='bxx';};nn++;if(nn>counts){nn=1;};tt=setTimeout('change_img()',speed);}; function changeimg(n){nn=n;window.clearInterval(tt);change_img();}; document.write('<style>'); document.write('.axx{padding:0px 7px 3px;*padding:1px 7px;border-left:#cccccc 1px solid;}'); document.write('a.axx:link,a.axx:visited{text-decoration:none;color:#fff;line-height:16px;font:12px sans-serif;background-color:#666;}'); document.write('a.axx:active,a.axx:hover{text-decoration:none;color:#fff;line-height:16px;font:12px sans-serif;background-color:#999;}'); document.write('.bxx{padding:0px 7px 3px;*padding:1px 7px;border-left:#cccccc 1px solid;}'); document.write('a.bxx:link,a.bxx:visited{text-decoration:none;color:#fff;line-height:16px;font:12px sans-serif;background-color:#D34600;}'); document.write('a.bxx:active,a.bxx:hover{text-decoration:none;color:#fff;line-height:16px;font:12px sans-serif;background-color:#D34600;}'); document.write('</style>'); document.write('<div style="width:'+widths+'px;height:'+heights+'px;overflow:hidden;text-overflow:clip;border:#f00 1px solid;">');
document.write('<div><a id="url"><img id="pic" style="border:0px;filter:progid:DXImageTransform.Microsoft.RevealTrans (duration=2,transition=23);" /></a></div>');
document.write('<div style="filter:alpha(style=1,opacity=30,finishOpacity=80);-moz-opacity:0.8; opacity:0.8;background: #888888;width:100%-2px;text-align:right;top:-'+top+'px;position:relative;margin:1px;height:24px;padding:0px;margin:0px;border:0px;'); if((ye==1)||(ti==1)){document.write('">');} else{document.write('display:none;">');}; if(ti==1){document.write('<div id="yu" style="filter:alpha(style=1,opacity=100,finishOpacity=30);height:12px;text-align:center;color:#F00;background-color:#6F0;line-height:16px;"></div>');}; //id=yu的div是显示标题的 if(ye==1){for(var i=1;i<counts+1;i++){document.write('<a href="javascript:changeimg('+i+');" id="xxjdjj'+i+'" class="axx" target="_self">'+i+'</a>');}};document.write('</div></div>'); change_img();</SCRIPT>