html<html<head lang="en"<meta charset="UTF-8"<titletitle</head<body<h1</h1<brbr<div id="div1"<div</div<div<div</div</div<div<div</div<div</div</div<div</div</div<brbr<ol<li</li<li</li<li</li</ol<hr<script src="../jQuery/jquery-1.12.2.min.js"script<script$("div div:last").css("color","orange"); ($("div div div:first-child").css("font-size","24px")); alert($("div div div").length);script<brbr<form action="#"<input type="text" onblur="aa()"<br<input type="password" onblur="bb()"<br</form<brbr<ol<li</li<li</li</ol<script src="../jQuery/jquery-1.12.2.min.js"script<scriptfunction aa(){ if($("form input").eq(0).val()==""){ $("form input").eq(0).val("请输入姓名:"); } else{ alert($("form input").eq(0).val()); } } function bb(){ var changdu=$("form input").eq(1).val().length; if(changdu>20){ var num= $("form input").eq(1).val().substr(0,20); $("form input").eq(1).val(num); } }script</body</html>
时间: 2024-10-23 17:02:37