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