이 예제는 주로 두 개의 매개 변수 OnBlur 및 OnFocus를 배웁니다. 이 두 매개 변수는 이전에는 거의 발생하지 않기 때문에 Baidu는 Onblur가 컨트롤이 초점을 잃을 때 트리거 된 이벤트임을 이해하고 OnFocus는 입력 초점이 될 때 트리거 된 이벤트입니다. 두 매개 변수 모두 클래스 이름과 결합하여 스타일 시트 클래스 이름을 직접 호출 할 수 있습니다.
<! doctype html public- // w3c // dtd html 4.01 Transitional // en http://www.w3.org/tr/html4/loose.dtd> <html> <헤드> <meta http-equiv = content-type content = text/html; charset = gb2312> <제목> </title> </head> <body> <스타일 유형 = 텍스트/CSS> .input1 { Font-Family : Verdana; 배경색 : #eeeeee; 국경-바닥 : #fffff 1px Solid; Border-Left : #CCCCCC 1PX Solid; Border-Right : #fffff 1px Solid; Border-Top : #CCCCCC 1PX SOLID; FONT-SIZE : 12PX; } .input1-bor { Font-Family : Verdana; 배경색 :#f0f8ff; 글꼴 크기 : 12px; 국경 : 1px 솔리드 #333333;} </스타일> <테이블 셀 패싱 = 2 셀 패딩 = 0 너비 = 300 경계 = 0> <tr> <td> <font class = en1> 이름 : </font> </td> <td> <input size = 40 name = name class = input1 onblur = this.classname = 'input1'onfocus = this.classname = 'input1-bor'> </td> </tr> <tr> <td> <font class = en1> 이메일 : </font> </td> <td> <input size = 40 name = email class = input1 onblur = this.classname = 'input1'onfocus = this.classname = 'input1-bor'> </td> </tr> <tr> <td> <font class = en1> 웹 사이트 : </font> </td> <td> <input size = 40 name = url class = input1 onblur = this.classname = 'input1'onfocus = this.classname = 'input1-bor'> </td> </tr> <tr> <td> <font class = en1> 테마 : </font> </td> <td> <입력 크기 = 40 이름 = 주제 클래스 = 입력 1 onblur = this.className = 'input1'onfocus = this.className = 'input1-bor'> </td> </tr> <tr> <td> <font class = en1> 내용 : </font> </td> <td> <textArea name = 메시지 행 = 5 cols = 35 class = input1 onblur = this.classname = 'input1'onfocus = this.classname = 'input1-bor'> </textarea> </td> </tr> </table> </body> </html> |