日期:2014-05-16 浏览次数:20361 次
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>My JSP 'JQueryStock.jsp' starting page</title> <link type="text/css" rel="stylesheet" href="css/stock.css"> <script type="text/javascript" src="${pageContext.request.contextPath }/js/jquery-1.10.1.min.js"></script> <script type="text/javascript"> $(document).ready(function() { //获取焦点 $("#username").focus(function() { var curValue = $(this).val(); if(curValue==this.defaultValue) { $(this).val(""); } }); //失去焦点 $("#username").blur(function() { var curValue = $(this).val(); if($.trim(curValue)=="") { $(this).val(this.defaultValue); } }); }); </script> </head> <body> 用户名<input type="text" name="username" id="username" value="邮箱/手机号/用户名"/><br/> 密码<input type="password" name="password" id="password"/><br/> </body> </html>