<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title></title> </head> <body> <p>帐号: <input type="text" name="" id="" value="" /></p> <p>密码: <input type="text" name= "" ID = "" value = "" /> </ P > </ body > </ HTML > < Script the src = "jQuery-3.4.1.js" type = "text / JavaScript" charset = "UTF- . 8 " > </ Script > < Script type =" text / JavaScript " > // focus () processing the obtained input box focus // bulr () processing the input box loses focus $ ( function () { $ ( ' INPUT: First ' ).focus(function() { $(this).css('background', '#eee'); }); $('input:first').blur(function() { $(this).css('background', '#fff'); }); $('input:enabled').focus(function() { $(this).css('background', '#eee'); }); $('input:enabled').blur(function() { $(this).css('background', '#fff'); }); }); </script>