'firstChild.nodeValue'에 해당되는 글 1건

  1. 2009.12.01 자바스크립트 온라인 사진첩
반응형
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  <title>가족 사진첩</title>
 <!--<script type="text/javascript" src="scripts/showPic.js"></script>-->
 <SCRIPT LANGUAGE="JavaScript">
 <!--
  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;
  }
 //-->
 </SCRIPT>
</head>
<body>
<h1>가족 사진</h1>
  <ul>
    <li>
      <a href="images/dad.jpg" title="멋있는 아빠 사진" onclick="showPic(this); return false;">아빠</a>
    </li>
    <li>
      <a href="images/mom.jpg" title="이쁜 엄마 사진" onclick="showPic(this); return false;">엄마</a>
    </li>
    <li>
      <a href="images/jisu.jpg" title="귀여운 지수 사진" onclick="showPic(this); return false;">딸</a>
    </li>
    <li>
      <a href="images/jisung.jpg" title="똑똑한 지성 사진" onclick="showPic(this); return false;">아들</a>
    </li>
  </ul>
  <img id="placeholder" src="images/placeholder.gif" alt="my image gallery" />
  <p id="description">사진을 선택하세요.</p>
</body>
</html>
Posted by 1010