1<! DOCTYPE html Public"-//w3c//dtd XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >234<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>5<title>js Exercises </title>6<script src= ". /jquery-1.11.2.min.js "></script><!--the jquery package --78 9<body>Ten Title: Create 4 text boxes, display white when there is no content in the text box, color change when there is input One<div> A<!--first create 4 text boxes in a div-- -<input type= "Text"class= "txt"/> -<input type= "Text"class= "txt"/> the<input type= "Text"class= "txt"/> -<input type= "Text"class= "txt"/> -</div> -</body> +<script type= "Text/javascript" > -$ (document). Ready (function(e) { + //Holiday an event that causes the text box to lose focus A$ (". txt"). Blur (function() { at if($ (this). Val ().Trim() !="") - { -$ (this). CSS ("Background-color", "#0FF");//As you type inside the text box, the color of the text box becomes #0ff color - } - Else - { in$ (this). CSS ("Background-color", "#C0F");//do not enter content in the text box (go to whitespace processing) or an empty string, the color of the text box becomes #c0f color - } to }); + - the }); * $ Panax Notoginseng -</script> theJS Exercise change text box status