<html>
<head>
<script>
window.onload=function(){
t1.onfocus=f1;
t2.onfocus=f1;
t3.onfocus=f1;
t1.onblur=f2;
t2.onblur=f2;
t3.onblur=f2;
}
function f1(){
this.style.backgroundColor="pink";
}
function f2(){
this.style.backgroundColor="";
}
</script>
</head>
<body>
<input type="text" id="t1">
<input type="text" id="t2">
<input type="text" id="t3">
</body>
</html>
'개발하자 > 자바스크립트' 카테고리의 다른 글
text value값을 id로 이용하기 eval,getElementById (0) | 2015.02.26 |
---|---|
window.open(새창띄우기) (0) | 2015.02.26 |
과제3(마우스클릭 좌표값을 이용해 div출력하기) (0) | 2015.02.24 |
과제2(선택한 링크의 내용 텍스트박스에 출력하기) (0) | 2015.02.24 |
과제1(공백유무,숫자유무,랜덤숫자와 내숫자 비교) (0) | 2015.02.24 |