Home > Web Front-end > JS Tutorial > Introduction to javascript·Picture object (no refresh transformation picture) scrolling image_image special effects

Introduction to javascript·Picture object (no refresh transformation picture) scrolling image_image special effects

WBOY
Release: 2016-05-16 19:08:33
Original
1055 people have browsed it
Copy code The code is as follows:

<%@LANGUAGE="JAVASCRIPT" CODEPAGE="936"%>




Image Object





演示一:无刷新变换图片(有点歪)



  
    1
    2
    3
    4
  
  


演示二:鼠标触发图片变换(书面名称好像叫图像滚动)




    //先建立两个数组,一组是on 状态的,一组是off状态的
    //数组使用的是字符串作索引,一来方便识别,二来在代码运行中不会冲突
    offimg=new Array()
    offimg["play"]=new Image(60,50)
    offimg["stop"]=new Image(60,50)
    offimg["pause"]=new Image(60,50)
    offimg["rewind"]=new Image(66,55)
    //赋值
    offimg["play"].src="img/1.jpg"
    offimg["stop"].src="img/2.jpg"
    offimg["pause"].src="img/3.jpg"
    offimg["rewind"].src="img/4.jpg"
    //第二个数组
    onimg=new Array()
    onimg["play"]=new Image(60,50)
    onimg["stop"]=new Image(60,50)
    onimg["pause"]=new Image(60,50)
    onimg["rewind"]=new Image(66,55)
    //赋值
    onimg["play"].src="img/5.jpg"
    onimg["stop"].src="img/6.jpg"
    onimg["pause"].src="img/7.jpg"
    onimg["rewind"].src="img/1.jpg"
    function on(imgname){
        if(document.images){//判断浏览器是否能够处理图片对象
            document.images[imgname].src=onimg[imgname].src//将对应的图片对象的src值赋给图片
        }
    }
    function off(imgname){
        if(document.images){//判断浏览器是否能够处理图片对象
            document.images[imgname].src=offimg[imgname].src//将对应的图片对象的src值赋给图片
        }
    }
    function setmsg(msg){//改变状态栏提示
        window.status=msg;
        return true;
    }


  
    
      
        
      
    
      

上面是DW做的
是预载入图片


    
    

      

      

     
  




source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template