这个东西怎么给图片添加链接啊?
<script>
var widths=550;
var heights=250;
var counts=3;
var urls =new Array();
img1=new Image ();img1.src='image/6.jpg';
img2=new Image ();img2.src='image/daohangtiao.jpg';
img3=new Image ();img3.src='image/chaoshanyizhan.jpg';
var nn=1;
var key=0;
function change_img()
{if(key==0){key=1;}
else if(document.all)
{document.getElementById("image").filters[0].Apply();document.getElementById("image").filters[0].Play(duration=2);} eval('document.getElementById("image").src=img'+nn+'.src');
eval('document.getElementById("url").target="_blank"'); 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()',3000);}
function changeimg(n){nn=n;window.clearInterval(tt); change_img();} document.write('<style>');
document.write('.axx{padding:1px 7px;border-left:#cccccc 1px solid;}');
document.write('a.axx:link,a.axx:visited{text-decoration:none;color:#fff;line-height:12px;font:9px sans-serif;background-color:#666;}');
document.write('a.axx:active,a.axx:hover{text-decoration:none;color:#fff;line-height:12px;font:9px sans-serif;background-color:#999;}');
document.write('.bxx{padding:1px 7px;border-left:#cccccc 1px solid;}');
document.write('a.bxx:link,a.bxx:visited{text-decoration:none;color:#fff;line-height:12px;font:9px sans-serif;background-color:#D34600;}');
document.write('a.bxx:active,a.bxx:hover{text-decoration:none;color:#fff;line-height:12px;font:9px sans-serif;background-color:#D34600;}');
document.write('</style>');
document.write('<div style="width:'+widths+'px;height:'+heights+'px;overflow:hidden;text-overflow:clip;">');
document.write('<div><a id="url"><img id="image" style="border:0px;filter:progid:dximagetransform.microsoft.wipe(gradientsize=1.0,wipestyle=4, motion=forward)" width='+widths+' height='+heights+' /></a></div>');
document.write('<div style="filter:alpha(style=1,opacity=10,finishOpacity=80);background: #888888;width:100%-2px;text-align:right;top:-12px;position:relative;margin:1px;height:12px;padding:0px;margin:0px;border:0px;">');
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>
<script>
var widths=550;
var heights=250;
var counts=3;
var urls =new Array();
img1=new Image ();img1.src='image/6.jpg';
img2=new Image ();img2.src='image/daohangtiao.jpg';
img3=new Image ();img3.src='image/chaoshanyizhan.jpg';
var nn=1;
var key=0;
function change_img()
{if(key==0){key=1;}
else if(document.all)
{document.getElementById("image").filters[0].Apply();document.getElementById("image").filters[0].Play(duration=2);} eval('document.getElementById("image").src=img'+nn+'.src');
eval('document.getElementById("url").target="_blank"'); 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()',3000);}
function changeimg(n){nn=n;window.clearInterval(tt); change_img();} document.write('<style>');
document.write('.axx{padding:1px 7px;border-left:#cccccc 1px solid;}');
document.write('a.axx:link,a.axx:visited{text-decoration:none;color:#fff;line-height:12px;font:9px sans-serif;background-color:#666;}');
document.write('a.axx:active,a.axx:hover{text-decoration:none;color:#fff;line-height:12px;font:9px sans-serif;background-color:#999;}');
document.write('.bxx{padding:1px 7px;border-left:#cccccc 1px solid;}');
document.write('a.bxx:link,a.bxx:visited{text-decoration:none;color:#fff;line-height:12px;font:9px sans-serif;background-color:#D34600;}');
document.write('a.bxx:active,a.bxx:hover{text-decoration:none;color:#fff;line-height:12px;font:9px sans-serif;background-color:#D34600;}');
document.write('</style>');
document.write('<div style="width:'+widths+'px;height:'+heights+'px;overflow:hidden;text-overflow:clip;">');
document.write('<div><a id="url"><img id="image" style="border:0px;filter:progid:dximagetransform.microsoft.wipe(gradientsize=1.0,wipestyle=4, motion=forward)" width='+widths+' height='+heights+' /></a></div>');
document.write('<div style="filter:alpha(style=1,opacity=10,finishOpacity=80);background: #888888;width:100%-2px;text-align:right;top:-12px;position:relative;margin:1px;height:12px;padding:0px;margin:0px;border:0px;">');
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菜单,SOS
- |zyciis| 一个DIV拖动,如何来防windows的拖动呢?拖动的时候产生一个虚框,拖动的内容半透明,虚框确定时DIV更新为他的位置,谢谢
- 准备在JS里混了,问个问题先。。。
- onMouseDown onMouseUp 事件的小疑问
- 如何获取<div></div>之间的文本内容?
- 在body设置禁用了右键,如何用javaScript恢复可以使用右键?
- 一个关于框架的问题
- 怎样控制Y滚动轴?
- 请教,一个页面里的脚本是否可以讲本页面里的东西重新绘制?? 谢谢
- 如何点击button按钮,激活gridpanel,使其数据显示出来
- 你们说学web开发未来有前途吗
- 选项卡之殇(为何代码被ff和opera hack了?)
楼主【yy709394】截止到2008-07-04 14:40:27的历史汇总数据(不包括此帖):
发帖的总数量:0 发帖的总分数:0
结贴的总数量:0 结贴的总分数:0
无满意结贴数:0 无满意结贴分:0
未结的帖子数:0 未结的总分数:0
结贴的百分比:---------------------结分的百分比:---------------------
无满意结贴率:---------------------无满意结分率:---------------------
如何结贴请参考这里:http://topic.csdn.net/u/20080501/09/ef7ba1b3-6466-49f6-9d92-36fe6d471dd1.html
oImg.onclick=function(){
//to-do:你的页面跳转代码
}
var widths=550;
var heights=250;
var counts=3;
var urls =new Array();
img1=new Image ();img1.src='image/6.jpg';
img2=new Image ();img2.src='image/daohangtiao.jpg';
img3=new Image ();img3.src='image/chaoshanyizhan.jpg'; var nn=1;
var key=0;
function change_img()
{
if(key==0)
{key=1;}
else if(document.all)
{
document.getElementById("image").filters[0].Apply();
document.getElementById("image").filters[0].Play(duration=2);
} eval('document.getElementById("image").src=img'+nn+'.src');
eval('document.getElementById("url").target="_blank"'); 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()',3000);
}
function changeimg(n){nn=n;window.clearInterval(tt); change_img();} document.write(' <style>');
document.write('.axx{padding:1px 7px;border-left:#cccccc 1px solid;}');
document.write('a.axx:link,a.axx:visited{text-decoration:none;color:#fff;line-height:12px;font:9px sans-serif;background-color:#666;}');
document.write('a.axx:active,a.axx:hover{text-decoration:none;color:#fff;line-height:12px;font:9px sans-serif;background-color:#999;}');
document.write('.bxx{padding:1px 7px;border-left:#cccccc 1px solid;}');
document.write('a.bxx:link,a.bxx:visited{text-decoration:none;color:#fff;line-height:12px;font:9px sans-serif;background-color:#D34600;}');
document.write('a.bxx:active,a.bxx:hover{text-decoration:none;color:#fff;line-height:12px;font:9px sans-serif;background-color:#D34600;}');
document.write(' </style>');
document.write(' <div style="width:'+widths+'px;height:'+heights+'px;overflow:hidden;text-overflow:clip;">');
document.write(' <div> <a id="url" href="#" > <img id="image" style="border:0px;filter:progid:dximagetransform.microsoft.wipe(gradientsize=1.0,wipestyle=4, motion=forward)" width='+widths+' height='+heights+' /> </a> </div>');
document.write(' <div style="filter:alpha(style=1,opacity=10,finishOpacity=80);background: #888888;width:100%-2px;text-align:right;top:-12px;position:relative;margin:1px;height:12px;padding:0px;margin:0px;border:0px;">');
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>
代码不错 我收藏了 不过你的人确实很懒列
都不整理一下就拿出来 谁有心思看撒
<!--
.axx{
padding:1px 7px;border-left:#cccccc 1px solid;}
a.axx:link,a.axx:visited{
text-decoration:none;color:#fff;line-height:12px;font:9px sans-serif;background-color:#666;}
a.axx:active,a.axx:hover{
text-decoration:none;color:#fff;line-height:12px;font:9px sans-serif;background-color:#999;}
.bxx{
padding:1px 7px;border-left:#cccccc 1px solid;}
a.bxx:link,a.bxx:visited{
text-decoration:none;color:#fff;line-height:12px;font:9px sans-serif;background-color:#D34600;}
a.bxx:active,a.bxx:hover{
text-decoration:none;color:#fff;line-height:12px;font:9px sans-serif;background-color:#D34600;}
-->
</style> <script>
var widths=310;
var heights=210;
var counts=3;
var urls =new Array();
img1=new Image ();img1.src='1.jpg';
img1.url="news.qq.com"
img2=new Image ();img2.src='2.jpg';
img3=new Image ();img3.src='3.jpg';
var sum=0;
var nn=1;
var key=0;
function change_img()
{
if(key==0)
{key=1;}
else if(document.all)
{
document.getElementById("image").filters[0].Apply();
document.getElementById("image").filters[0].Play(duration=2);
}
eval('document.getElementById("image").src=img'+nn+'.src');
eval('document.getElementById("url").target="_blank"');
if(sum==0)
eval('document.getElementById("url").href="http://news.qq.com"');
else if(sum==1)
eval('document.getElementById("url").href="http://www.baidu.com"');
else
eval('document.getElementById("url").href="http://www.google.com"');
sum++
if(sum>2)
sum=0
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()',3000);
}
function changeimg(n){
nn=n;
window.clearInterval(tt);
change_img();} document.write(' <div style="width:'+widths+'px;height:'+heights+'px;overflow:hidden;text-overflow:clip;">'); document.write(' <div> <a id="url" > <img id="image" style="border:0px;filter:progid:dximagetransform.microsoft.wipe(gradientsize=1.0,wipestyle=4, motion=forward)" width='+widths+' height='+heights+' /> </a> </div>'); document.write(' <div style="filter:alpha(style=1,opacity=10,finishOpacity=80);background: #888888;width:100%-2px;text-align:right;top:-12px;position:relative;margin:1px;height:12px;padding:0px;margin:0px;border:0px;">'); 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>