ตัวอย่างนี้ส่วนใหญ่เรียนรู้พารามิเตอร์สองตัว OnBlur และ OnFocus เนื่องจากพารามิเตอร์ทั้งสองนี้ไม่ค่อยพบมาก่อน Baidu เข้าใจว่า Onblur เป็นเหตุการณ์ที่เกิดขึ้นเมื่อการควบคุมสูญเสียโฟกัสและ OnFocus เป็นเหตุการณ์ที่เกิดขึ้นเมื่อมันกลายเป็นโฟกัสอินพุต พารามิเตอร์ทั้งสองสามารถรวมกับ className เพื่อเรียกชื่อคลาสสไตล์แผ่นโดยตรง
<! doctype html สาธารณะ -// w3c // dtd html 4.01 transitional // en http://www.w3.org/tr/html4/loose.dtd> <html> <head> <meta http-equiv = เนื้อหาประเภทเนื้อหา = text/html; charset = gb2312> <title> </title> </head> <body> <style type = text/css> .input1 { FONT-FAMILY: Verdana; พื้นหลังสี: #EEEEEE; ขอบด้านล่าง: #FFFFF 1PX ของแข็ง; ชายแดนซ้าย: #CCCCCC 1PX ของแข็ง; ชายแดนขวา: #FFFFF 1PX ของแข็ง; - .input1-bor { Font-Family: Verdana; พื้นหลังสี:#F0F8FF; FONT-SIZE: 12PX; ชายแดน: 1px Solid #3333333;} </style> <Table Cellpacing = 2 CellPading = 0 Width = 300 Border = 0> <tr> <td> <font class = en1> ชื่อ: </font> </td> <td> <อินพุตขนาด = 40 name = name class = input1 onblur = this.className = 'input1' onFocus = this.className = 'input1-bor'> </td> </tr> <tr> <td> <font class = en1> อีเมล: </font> </td> <td> <อินพุตขนาด = 40 name = email class = input1 onblur = this.className = 'input1' onfocus = this.className = 'input1-bor'> </td> </tr> <tr> <td> <font class = en1> เว็บไซต์: </font> </td> <td> <อินพุตขนาด = 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 name = subject class = input1 onblur = this.className = 'input1' onFocus = this.className = 'input1-bor'> </td> </tr> <tr> <td> <font class = en1> เนื้อหา: </font> </td> <td> <textarea name = rows message = 5 cols = 35 class = input1 onblur = this.className = 'input1' onFocus = this.className = 'input1-bor'> </textarea> </td> </tr> </table> </body> </html> |