jQuery插件placeholder的使用方法
jQuery插件placeholder的使用方法
今天有空演示一下jQuery插件placeholder的使用方法,借助该插件可以轻松实现HTML5中placeholder特效:
效果图:
实现代码:
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+request.getContextPath()+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>借助jQuery placeholder实现HTML5中placeholder特效</title>
<script type="text/javascript" src="<%=basePath%>js/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="<%=basePath%>js/jquery.placeholder.js"></script>
<script type="text/javascript">
$(function() {
$('input, textarea').placeholder();
});
</script>
<style type="text/css">
input, textarea { font-family: Helvetica, Arial; color: #000;}
.placeholder {color: #aaa;}
</style>
</head>
<body>
<center style="margin-top: 10%"><font style="font-size: 18pt; font-weight: bold;font-weight: bold; color: red;">借助jQuery placeholder实现HTML5中placeholder特效</font></center><br><br>
<center><font style="font-size: 18pt; font-weight: bold;font-weight: bold; color: red;">帮客之家 www.Linuxidc.com</font></center><br><br>
<input type="text" id="userName" name="userName" placeholder="请输入用户名…" style="margin-bottom: 12px;"><br>
<input type="password" id="password" name="password" placeholder="请输入密码…" style="margin-bottom: 12px;"><br>
<textarea id="personalInformation" name="personalInformation" rows="3" cols="50" maxlength="200" placeholder="请输入个人信息…"></textarea>
</body>
</html>
说明:上面例子并不是HTML5页面,但由于使用了该插件所以看上去和HTML5的效果差不多;上面例子使用了jquery-1.8.3.min.js和jquery.placeholder.js两个文件,这两个文件可在下面的下载资源中找到。
------------------------------------------分割线------------------------------------------
免费下载地址在 http://linux.bkjia.com/
用户名与密码都是www.bkjia.com
具体下载目录在 /2014年资料/8月/12日/jQuery插件placeholder的使用方法/
下载方法见
------------------------------------------分割线------------------------------------------
jQuery权威指南 PDF版中文+配套源代码
jQuery实战 中文PDF+源码
《jQuery即学即用(双色)》 PDF+源代码
锋利的jQuery(第2版) 完整版PDF+源码
jQuery完成带复选框的表格行高亮显示
jQuery基础教程(第4版) PDF 完整高清版+配套源码
--------------------------------------分割线 --------------------------------------
jQuery 的详细介绍:请点这里
jQuery 的下载地址:请点这里
本文永久更新链接地址:
评论暂时关闭