هذا المثال يتعلم أساسا معلمتين onblur و onfocus. نظرًا لأن هاتين المعلمتين نادراً ما يتم مواجهتهما من قبل ، فإن Baidu يدرك أن Onblur هو حدث يتم تشغيله عندما يفقد عنصر التحكم التركيز ، وأن Onfocus هو حدث يتم تشغيله عندما يصبح تركيز المدخلات. يمكن دمج كلا المعلمات مع اسم className للاتصال مباشرة باسم فئة ورقة الأنماط.
<! doctype html public -// w3c // dtd html 4.01 Transitional // en http://www.w3.org/tr/html4/loose.dtd> <html> <head> <meta http-equiv = content-type content = text/html ؛ charset = gb2312> <title> </title> </head> <body> <نوع النمط = text/css> .input1 { Font-Family: Verdana ؛ خلفية اللون: #EEEEE ؛ Border-Bottom: #fffff 1px Solid ؛ Lorder-Left: #cccccc 1px Solid ؛ Border-Right: #fffff 1px Solid ؛ Border-Top: #ccccc 1px solid ؛ font-size: 12px ؛ } .input1-bor { Font-Family: Verdana ؛ خلفية اللون:#f0f8ff ؛ حجم الخط: 12px ؛ الحدود: 1 بكسل Solid #333333 ؛} </style> <table cellpacing = 2 cellpading = 0 width = 300 border = 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> </r> <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> </r> <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> </r> <tr> <td> <font class = en1> السمة: </font> </td> <td> <input size = 40 name = toffice class = input1 onblur = this.className = 'input1' onfocus = this.className = 'input1-bor'> </td> </r> <tr> <td> <font class = en1> المحتوى: </font> </td> <td> <textarea name = message rows = 5 cols = 35 class = input1 onBlur = this.className = 'input1' onfocus = this.classname = 'input1-bor'> </sevidea> </td> </tr> </table> </body> </html> |