Smooth degradation, JS and HTML tag separation, extreme performance of JavaScript picture library

Source: Internet
Author: User

1 <!DOCTYPE HTML>2 <HTMLLang= "en">3 <Head>4 <MetaCharSet= "UTF-8">5 <title>JavaScript Picture Library</title>6 <Scripttype= "Text/javascript">7     <!--JS Image Library with smooth degradation, JS and HTML tag separation, extreme performance -8     functionShowpic (whichpic) {9         varplaceholder=document.getElementById ("placeholder");Ten         if(!placeholder) { One             return false; A         } -         varSource=Whichpic.getattribute ("href"); - Placeholder.setattribute ("src", source); the         vardesc=document.getElementById ("Description"); -         if(DESC) { -             vartext=Whichpic.getattribute ("title"); - desc.childnodes[0].nodevalue=text; +         } -         return true; +     } A     functionbind () { at         if(!document.getElementById) { -            return false; -         } -         if(!document.getelementsbytagname) { -             return false; -         } in         varMygallery=document.getElementById ('Gallery'); -         vara=Mygallery.getelementsbytagname ("a"); to          for(varI=0; I<A.length;i++){ + A[i].onclick=function(){ -                 return !Showpic ( This); the             } *         } $     }Panax Notoginseng window.onload=bind; - </Script> the </Head> + <Body> A <ulID= "Gallery"> the     <Li><ahref= "IMAGE/1 (1). jpg"title= "nice frosted glass 1">Frosted Glass 1</a> </Li> +     <Li><ahref= "IMAGE/1 (2). jpg"title= "Nice frosted glass 2">Frosted Glass 2</a> </Li> -     <Li><ahref= "IMAGE/1 (3). jpg"title= "Nice frosted glass 3">Frosted Glass 3</a> </Li> $     <Li><ahref= "IMAGE/1 (4). jpg"title= "Nice frosted glass 4">Frosted Glass 4</a> </Li> $ </ul> - <imgID= "Placeholder"src= "Image/placeholder.jpg"alt= "My Image Gallery" /> - <PID= "description">Choose an image</P> the </Body> - </HTML>

Smooth degradation, JS and HTML tag separation, extreme performance of JavaScript picture library

Related Article

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.