Das Onfocus -Ereignis ist ein Ereignis, das auftritt, wenn der Cursor in das Textfeld fällt.
Das Onblur -Ereignis ist ein Ereignis, das auftritt, wenn der Cursor den Fokus verliert.
Sie können das folgende Beispiel schreiben
1.html
<Html> <kopf> <title> Verwenden Sie Onblur Ereignishandler </title> </head> <body bgcolor = "lavendel"> <Formularname = "F1"> <Eingabe type = text name = text1 value = "1111onblur_green" onblur = "(document.bgcolor = 'green'). Onblur = "(document.bgcolor = 'schwarz')"> <Eingabe type = text name = text2 value = "3333onblur_yellow" onblur = "(document.bgcolor = 'gelb')"> <br> <p> <Eingabe type = texte TYPE=text NAME=text4 value="5555onfocus_red" onfocus="(document.bgColor='red')"><INPUT TYPE=text NAME=text4 value="6666onfocus_orange" onfocus="(document.bgColor='orange')"></FORM> </BODY> </HTML>
Es finden Sie auch Beispiele unten
2.html
<!-Dateibeschreibung: Onfocus-Ereignis-> <!- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- <Eingabe type = "text" name = "test2" value = "Ich kann es nicht ausschalten, sobald ich gedrückt habe, haha" onfocus = alert ("Ich wurde der Eingangsfokus!")> </body> </html>Das obige Klischee spricht über den Onblur -Vorfall und der Onfocus -Vorfall (JS) sind alle Inhalte, die ich mit Ihnen teile. Ich hoffe, Sie können Ihnen eine Referenz geben und ich hoffe, Sie können wulin.com mehr unterstützen.