Conversion of Images Written in Javascript

Source: Internet
Author: User

<HTML>
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = gb2312"/>
<SCRIPT Lanuage = 'javascript '>
Function controlimg (imgid)
{
This. objid = imgid;
This. imgnum = 0;
This. imgarr = new array ();
}

Controlimg. Prototype. Add = addimg;
Controlimg. Prototype. loadpic = preload;
Controlimg. Prototype. Convert = changeimg;

Function addimg (imgsrc, href)
{
This. imgarr [This. imgarr. Length] = {
"Imgsrc": imgsrc,
"Href": href
}
}

Function preload (){
For (I = 0; I <this. imgarr. length; I ++)
{
Eval ("IMG _" + this. objid + "_" + I + "= new image ()");
Eval ("IMG _" + this. objid + "_" + I + ". src = This. imgarr [I]. imgsrc ");
}
}

Function changeimg (PICPOS)
{
If (this. imgnum> = This. imgarr. length)
{
This. imgnum = 0;
}
/* If (PICPOS. length! = 0)
{
This. imgnum = math. Round (PICPOS );
}*/
VaR obj_img = Document. getelementbyid (this. objid );
Obj_img.style.filter = (obj_img.style.filter = "revealtrans ")? "Revealtrans": "blendtrans ";
Obj_img.style.filter.duration = 3.0000;
Obj_img.style.filter.transition = 23;
Obj_img.filters (0). Apply ();
Obj_img.src = This. imgarr [This. imgnum]. imgsrc;
Obj_img.parentnode.href = This. imgarr [This. imgnum]. href;
Obj_img.filters (0). Play ();
This. imgnum = This. imgnum + 1;
// Window. setTimeout ("changeimg ()", 3000 );
}
VaR obj_convert;
Function Init ()
{
Obj_convert = new controlimg ("IMG ")
Obj_convert.add ("images/00logo.gif", "http://www.google.com ");
Obj_convert.add ("images/0.gif"," http://www.baidu.com ");
Obj_convert.add ("images/06top_42.gif", "http://www.csdn.net ");
Obj_convert.loadpic ();
Window. setinterval ("Maid ()", 3000 );
}

</SCRIPT>
</Head>




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.