Share Pastebin
Guest
Public paste!

Untitled

By: a guest | Sep 2nd, 2010 | Syntax: HTML | Size: 2.96 KB | Hits: 52 | Expires: Never
Copy text to clipboard
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  2. <html>
  3. <head>
  4.         <meta http-equiv="imagetoolbar" content="no" />
  5.         <meta name="keywords" content="포토샵,포샵질" />
  6.         <meta name="Author" content="ganji" />
  7.         <meta http-equiv="content-type" content="text/html; charset=euc-kr" />
  8.         <title> 문서 </title>
  9.  
  10.         <style type="text/css" media="all">
  11.         /* input 의 스타일 */
  12.         .gInput {
  13.                 background-color:#fbfbfb;
  14.                 height:22px;
  15.                 font:12px "굴림";
  16.                 color:#333;
  17.                 border:1px solid #ddd;
  18.                 padding:3px;
  19.         }
  20.         .gInput_on {
  21.                 background-color:#fff;
  22.                 height:22px;
  23.                 font:12px "굴림";
  24.                 color:#333;
  25.                 border:1px solid #39f;
  26.                 padding:3px;
  27.         }
  28.  
  29.         /* textarea 의 스타일 */
  30.         .gInput_t {
  31.                 background-color:#fbfbfb;
  32.                 height:50px;
  33.                 font:12px "굴림";
  34.                 color:#333;
  35.                 border:1px solid #ddd;
  36.                 padding:3px;
  37.         }
  38.         .gInput_t_on {
  39.                 background-color:#fff;
  40.                 height:50px;
  41.                 font:12px "굴림";
  42.                 color:#333;
  43.                 border:1px solid #39f;
  44.                 padding:3px;
  45.         }
  46.  
  47.         .gTb {background-color:#eee; width:600px; table-layout:fixed;}
  48.                 .gTb tr{background-color:#fff; font:11px '돋움'; letter-spacing:-1px;}
  49.                         .gTb tr td.tdL{background-color:#fbfbfb; font-weight:bold;}
  50.         </style>
  51. </head>
  52. <body>
  53.  
  54. <form id="w_form" name="w_form">
  55. <table class="gTb" cellSpacing="1" cellpadding="5" border="0">
  56.     <colgroup><col width="150px" /><col /></colgroup>
  57.     <tbody>
  58.     <tr>
  59.         <td class="tdL">아이디</td>
  60.         <td><input type="text" class="gInput" size="40" /></td>
  61.     </tr>
  62.     <tr>
  63.         <td class="tdL">비밀번호</td>
  64.         <td><input type="password" class="gInput" size="40" /></td>
  65.     </tr>
  66.     <tr>
  67.         <td class="tdL">내용</td>
  68.         <td><textarea style="width:100%;" class="gInput_t"></textarea></td>
  69.     </tr>
  70.     </tbody>
  71. </table>
  72. </form>
  73. <br />
  74.  
  75. 타겟 밖에 있을 경우에는 적용 안함 : <input type="password" class="gInput" size="40" />
  76.  
  77. <script type="text/javascript" language="JavaScript">
  78. //<![CDATA]
  79. function ipt_onClass(tgId, className1, className2){ // 타겟 아이디, input의 className, textarea의 className
  80.         var f_ipt = document.getElementById(tgId).getElementsByTagName("input"); // 타겟에 속해있는 모든 input
  81.         var txta = document.getElementById(tgId).getElementsByTagName("textarea"); // 타겟에 속해있는 모든 textarea
  82.  
  83.         for(i = 0; i < txta.length; i++) { // textarea 처리
  84.                 txta[i].onfocus = function() {
  85.                         this.className=className2+'_on';
  86.                 }
  87.                 txta[i].onblur = function() {
  88.                         this.className=className2;
  89.                 }
  90.         }
  91.  
  92.         for(i = 0; i < f_ipt.length; i++) { // input의 typetext 또는 password 라면 처리
  93.                 if(f_ipt[i].type=="text" || f_ipt[i].type=="password"){
  94.                         f_ipt[i].onfocus = function() {
  95.                                 this.className=className1+"_on";
  96.                         }
  97.                 }
  98.  
  99.                 if(f_ipt[i].type=="text" || f_ipt[i].type=="password"){
  100.                         f_ipt[i].onblur = function() {
  101.                                 this.className=className1;
  102.                         }
  103.                 }
  104.         }
  105. }
  106.  
  107. ipt_onClass('w_form', 'gInput', 'gInput_t');
  108. //]]>
  109. </script>
  110.  
  111. </body>
  112. </html>