<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'index.jsp' starting page</title>
<meta http-equiv="context-type" content="text/html;charset=utf-8">
<script type="text/javascript">
function check(o){
if(o.value=='') {
document.getElementById('input_Info').style.display='block';
}
}
</script>
</head>
<body>
<form action="search" method="post">
请输入运单号:<input type="text" style="font-size:16px;font-weight:100;" id="search" name="search" onfocus="document.getElementById('input_Info').style.display='none';"
onblur="check(this);" /> <input type="submit">
<div id="input_Info" style="position:relative;top:-25px;left:115px;font-size:16px;font-weight:100;" onclick="document.getElementById('search').focus();">请输入...</div>
</form>
</body>
</html>
显示效果
鼠标点击输入框, 请输入消失 。。。。
还有一个是div 在table标签无法隐藏,可以在table里加一个tbody 里面放div 。