미술관

8381 단어
 1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 2 <html xmlns="http://www.w3.org/1999/xhtml">
 3 <head>
 4     <title> </title>
 5     <style type="text/css">
 6         .imageSmall
 7         {
 8             width: 112px;
 9             height: 70px;
10         }
11         #img1
12         {
13             margin-left: 200px;
14         }
15     </style>
16     <script type="text/javascript">
17         onload = function () {
18             // img 
19             var imageSmall = document.getElementById("img1");
20             // div 
21             var dv = document.getElementById("dv");
22             // 
23             imageSmall.onclick = function () {
24                 if (dv.getElementsByTagName("img")) {
25                 // , ,dv 
26                     dv.innerHTML="";
27                 }
28 
29                 // div 
30                 var imageLarge = document.createElement("img");
31                 dv.appendChild(imageLarge);
32                 imageLarge.src = imageSmall.src;
33                 imageLarge.alt = " ";
34             }
35         }
36     </script>
37 </head>
38 <body>
39     <img class="imageSmall" id="img1" src="source/image/01.jpg" />
40     <img class="imageSmall" id="img2" src="source/image/02.jpg" />
41     <img class="imageSmall" id="img3" src="source/image/03.jpg" />
42     <img class="imageSmall" id="img4" src="source/image/04.jpg" />
43     <img class="imageSmall" id="img5" src="source/image/05.jpg" />
44     <div id="dv">
45     </div>
46 </body>
47 </html>

좋은 웹페이지 즐겨찾기