图片滚动及更换

<html>

 <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
</head>

<body >

<table >

<tr>

<!--更换的大图-->

 <td width="85%"><img src="image/Graphic Design_900X600/12.jpg" style=" margin:10px 20px 32px 5px;" alt=""荔枝湾旅游地图(第一版)"设计" width="502" height="394" border="0" id="main_img" rel="images/03.jpg" link="http://焦点" /></td>
        <!-- 滚动内容 -->

                       <td width="15%">
                        <div id=demo style="overflow:hidden; height:350px;">
                          <div id="demo1"> <img src="image/Graphic Design_200X150/12.jpg" alt=""设计"  border="0" class="thumb_img" rel="image/Graphic Design_900X600/12.jpg" link="http://焦点" οnclick="javascript:window.open('Graphic_Design12.html') "/> <img src="image/Graphic Design_200X150/08.jpg" alt="中央"  border="0" class="thumb_img" rel="image/Graphic Design_900X600/08.jpg" link="http://焦点" οnclick="javascript:window.open('Graphic_Design08.html')" /> <img src="image/Graphic Design_200X150/09.jpg" alt="签名"  border="0" class="thumb_img" rel="image/Graphic Design_900X600/09.jpg" link="http://焦点" οnclick="javascript:window.open('Graphic_Design09.html')" /> <img src="image/Graphic Design_200X150/10.jpg" alt="信片"  border="0" class="thumb_img" rel="image/Graphic Design_900X600/10.jpg" link="http://焦点" οnclick="javascript:window.open('Graphic_Design10.html')" />  </div>
                          <div id=demo2></div>
                        </div>
                        <script language="javascript">
var speed=30;
 demo2.innerHTML=demo1.innerHTML;
demo.scrollTop=demo.scrollTop;
function Marquee(){
if(demo1.offsetTop-demo.scrollTop>=0)
demo.scrollTop+=demo2.offsetHeight;
else{
demo.scrollTop--
}
}
var MyMar=setInterval(Marquee,speed)
demo.οnmοuseοver=function() {clearInterval(MyMar)}
demo.οnmοuseοut=function() {MyMar=setInterval(Marquee,speed)}
</script></td>
                    </tr>
                  </table>
                   <!--<script type="text/javascript">
swfobject.registerObject("FlashID");
swfobject.registerObject("FlashID");-->
</script>
</body>
</html>
<!--更换图片-->
<script language="javascript" type="text/javascript">
 function $(e) {
            return document.getElementById(e);
        }
document.getElementsByClassName = function(cl) {
    var retnode = [];
    var myclass = new RegExp('\\b'+cl+'\\b');
    var elem = this.getElementsByTagName('*');
    for (var i = 0; i < elem.length; i++) {
        var classes = elem[i].className;
        if (myclass.test(classes)) retnode.push(elem[i]);
    }
    return retnode;
}
var MyMar;
var speed = 30; //速度,越大越慢
var spec = 30; //每次滚动的间距, 越大滚动越快
var ipath = 'image/'; //图片路径

var thumbs = document.getElementsByClassName('thumb_img');
for (var i=0; i<thumbs.length; i++) {
    thumbs[i].onmouseover = function () {$('main_img').src=this.rel; $('main_img').link=this.link;};
    //thumbs[i].onclick = function () {location = this.link}
}
//$('main_img').onclick = function () {location = this.link;}
$('gotop').onmouseover = function() {this.src = ipath + 'gotop2.gif'; MyMar=setInterval(gotop,speed);}
$('gotop').onmouseout = function() {this.src = ipath + 'gotop.gif'; clearInterval(MyMar);}
$('gobottom').onmouseover = function() {this.src = ipath + 'gobottom2.gif'; MyMar=setInterval(gobottom,speed);}
$('gobottom').onmouseout = function() {this.src = ipath + 'gobottom.gif'; clearInterval(MyMar);}
function gotop() {$('showArea').scrollTop-=spec;}
function gobottom() {$('showArea').scrollTop+=spec;}
</script>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值