NOTICE

ID/PW 위에 글 나타내기

Date : 2007. 11. 26. 11:58 Category : Programming/Javascript
(Language : html4strict)
  1.     <input type="text" name="userID" id="userID" />
  2.     <input type="password" name="userPW" id="userPW" />
  3. </form>
  4. <div style="position:absolute; top:~px; left:~px;" onClick="this.style.display='none'; document.getElementById('userID').focus();">ID</div>
  5. <div style="position:absolute; top:~px; left:~px;" onClick="this.style.display='none'; document.getElementById('userPW').focus();">PW</div>

단순히 input 안에 value="ID", value="PW"를 줄 수가 있다.
하지만 이럴 경우 ID 부분은 괜찮지만 PW 부분은 속성이 password이기 때문에 ** 이렇게 나타난다.
그래서 폼 위에 레이어를 하나 얹어서 쓰는 게 편하다.
position이 relative가 아니라 absolute기 때문에 좌표값 잡아 주는 것은 해당 페이지에 맞춰서 해야 정상적으로 나타난다.


고수들이 보기엔 졸라 간단한 거지만...
나도 처음에 이런 거 몰랐을 땐 참...ㅋㅋ
방법은 여러 가지다.
그 여러 가지 방법 중에서 난 이런 방법을 쓸 뿐이다.