JavaScript DOM编程艺术_Chapter 4

showPic.js

function showPic(whichpic) {
  var source = whichpic.getAttribute("href");
  var placeholder = document.getElementById("placeholder");
  placeholder.setAttribute("src",source);
  var text = whichpic.getAttribute("title");
  var description = document.getElementById("description");
  description.firstChild.nodeValue = text;
}

 

layout.css

body {
  font-family: "Helvetica","Arial",serif;
  color: #333;
  background-color: #ccc;
  margin: 1em 10%;
}
h1 {
  color: #333;
  background-color: transparent;
}
a {
  color: #c60;
  background-color: transparent;
  font-weight: bold;
  text-decoration: none;
}
ul {
  padding: 0;
}
li {
  float: left;
  padding: 1em;
  list-style: none;
}

 

gallery.html

"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">


 
  Image Gallery
 
 


 

Snapshots


 

       

  •       Fireworks
       

  •    

  •       Coffee
       

  •    

  •       Rose
       

  •    

  •       Big Ben
       

  •  

  my image gallery
 

Choose an image.




你可能感兴趣的:(JavaScript,JavaScript,DOM,HTML)