Text|Password

Language/JAVASCRIPT 2010. 5. 10. 15:30

Text 개체와 Password 개체는 기본적을 동일하다, 다만 Text 개체는 입력한 문자가 보이고 Password 개체에서는 입력한 문자를 감추기 위해 asterisks(*)으로 표시된다는 점이다.

property(속성)

method(메써드)

event handlers

netscape6.0

Expolorer

netscape6.0

Explorer

공통

defaultValue
defaultvalue
blur
Blur
onBlur
form
Form
focus
Focus
onClick
name
Name
    
 
onDblClick
type
Type
select
select
onfocus
value
Value
click
click
onKeyDown
accessKey
accessKey
 
applyElement
onKeyUp
disabled
disabled
addEventListener
attachEvent
onKeyPress
maxLength
maxLength
removeEventListener
detachEvent
onMouseDown
readOnly
readOnly
insertBefore
insertBefore
onMouseUp
size
size
replaceChild
replaceChild
onMouseOver
id
id
removeChild
removeChild
onMouseOut
title
title
../data/lecture/hcjd/appendixcdChild
../data/lecture/hcjd/appendixcdChild
 
lang
lang
hasChildNodes
hasChildNodes
 
dir
dir
cloneNode
cloneNode
 
className
className
 
removeNode
 
style
style
 
replaceNode
 
innerHTML   
 
 
swapNode
 
 
outerHTML
 
clearAttributes
 
 
outerText
getAttribute
getAttribute
 
tagName
tagName
setAttribute
setAttribute
 
offsetTop
offsetTop
removeAttribute
removeAttribute
 
offsetLeft
offsetLeft
 
mergeAttributes
 
offsetWidth
offsetWidth
getAttributeNode    
   
offsetHeight
offsetHeight
setAttributeNode    
   
offsetParent
offsetParent
removeAttributeNode 
   
 
clientHeight
getElementsByTagName 
   
 
clientLeft
 
contains
 
 
clientTop
 
insertAdjacentHTML
 
 
clientWidth
 
insertAdjacentText
 
 
isContentEditable
 
insertAdjacentElement
 
 
contentEditable
 
getAdjacentText
 
 
canHaveChildren
 
replaceAdjacentText
 
 
canHaveHTML
 
setActive
 
ownerDocument   
 
 
setExpression
 
nodeName
nodeName
 
getExpression
 
nodeValue
nodeValue
 
removeExpression
 
nodeType
nodeType
 
scrollIntoView
 
parentNode
parentNode
     
childNodes  
       
 
parentElement
     
firstChild
firstChild
     
lastChild
lastChild
     
previousSibling
previousSibling
     
nextSibling
nextSibling
     
attributes  
       
    
       
 
isDisabled
     
 
disabled
     
 
tabIndex
     
 
isTextEdit
     
 
parentTextEdit
     
 
width
     
 
sourceIndex
     
 
scrollHeight
     
 
scrollLeft
     
 
scrollTop
     
 
scrollWidth
     
 

아래에서  설명되지 않은 것은 div개체를 참고하세요.

 

 

<INPUT type="text(password)"  name=" " value=" " >

 

form

Text(Password) 개체를 포함하고 있는 폼을 나타내는 속성이다.
 

 

object.form

 

name

Text(Password)  개체의 name 속성을 나타내는 속성이다.
 

 

object.name [ = ①string ]
①string: name 속성을 나타내는 문자열

 

type

이 속성은 Text(Password)  개체의 type을 나타내는 것으로 값은 항상 "text(password)"이다.
 

value

폼이 서버로 제출될 때 Text(Password)  개체의 값을 나타내는 속성이다.
 

 

[ ①string = ] textobject.value
① string : 보내질 값을 나타내는 문자열

 

defaultValue

개체의 기본값을 나타내는 속성이다.
 

 

 object.defaultValue [ = ①string ]
①string: 개체의 기본값을 지정하는 문자열

 

disabled

사용자가 Text(Password)  개체에 text를 입력가능한 상태로 만들것인지를 나타내는 속성이다.
 

 

object.disabled [ = ①boolean ]

① Boolean 값으로 지정할 수 있는 것은 다음과 같다.
true
Text(Password)  개체를 꺼 놓은 상태
false
Text(Password)  개체를 꺼 놓지 않은 상태
 

maxLength

사용자가 Text(Password) 개체에 최대로 입력가능한 문자의 수를 나타내는 속성이다.
 

 

 object.maxLength [ = ①interger ]
 ① interger: 최대 입력가능한 문자의 수를 지정하는 정수

 

size

Text(Password)  개체의 크기를 나타내는 속성이다.
 

 

object.size [ = ①interger ]
①Integer : 문자수로 계산된 개체의 크기를 지정하는 정수.

 

readOnly

Text(Password)  개체는 사용자로부터 text를 입력받기 위한 개체인데 사용자가 Text(Password)  개체에 있는 text를 편집하거나 입력하지 못하게 할 것인가를 지정하는 속성이다.
 

 

object.readOnly [ = ①boolean ]

① Boolean 값으로 지정할 수 있는 것은 다음과 같다.
true
Text(Password)  개체는 읽기 전용이다.
false
Text(Password)  개체는 읽기 전용이 아니다. 기본값
 

 

text-pass.htm
예는 id와 password를 제대로 입력하면 netscape를 읽어들이고 그렇지 않으면 id와 password를 잘못 입력했다는 메시지를 보여준다.
<html>
<head>
<title>text password</title>
<script-x language="JavaScript-x">
<!-- JavaScript-x
function login(x){
 if(x.idtxt.value=="guest" && x.passtxt.value=="2000"){
   window.location="http://www.netscape.com"
 }else{
  alert("ID 또는 password를 잘못 입력하셨군요");
  }
}
// - JavaScript-x - -->
</script-x>
</head>
 
<body bgcolor="white" text="black" link="blue" vlink="purple" alink="red">
    <p>&nbsp;id에 guest를 password에 2000을 입력하세요</p>
<form name="form2">
    <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ID:
    <input type="text" name="idtxt"></p>
    <p>PASSWORD :<input type="password" name="passtxt"></p>
    <p><input type="button" name="loginbtn" value="Log in" onClick="login(this.form);">
       <input type="reset" name="resetbtn" value="다시 작성"></p>
</form>
<p>&nbsp;</p>
</body>
</html>
 

 

 

 

function login(x){

 if(x.idtxt.value=="guest" && x.passtxt.value=="2000"){

   window.location="http://www.helpme119.co.kr"

idtxt라는 텍스트 개체의 value 속성이 guest이고 passtxt라는 password개체의 value 속성이 2000이라면 이 조건이 실행된어 브라우저 창에 helpme119 홈 페이지를 읽어 들이다.

 

 }else{

위 if 조건을 충족하지 않는 예외 상황을 처리한다.

 

alert("ID 또는 password를 잘못 입력하셨군요");

id나 password가 잘못 입력되었다는 경고메시지를 보여준다.

  }

[출처] Text|Password|작성자 해피캐빈

'Language > JAVASCRIPT' 카테고리의 다른 글

Option  (0) 2010.05.10
Radio  (0) 2010.05.10
Hidden  (0) 2010.05.10
Fileupload (파일 업로드)  (0) 2010.05.10
checkbox  (0) 2010.05.10
: