你好,游客 登录 注册 搜索
背景:
阅读新闻

jQuery插件placeholder的使用方法

[日期:2014-08-12] 来源:Linux社区  作者:gaohuanjie [字体:大 中 小]

今天有空演示一下jQuery插件placeholder的使用方法,借助该插件可以轻松实现HTML5中placeholder特效:

效果图:

jQuery插件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;">Linux公社 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.linuxidc.com/

用户名与密码都是www.linuxidc.com

具体下载目录在 /2014年资料/8月/12日/jQuery插件placeholder的使用方法/

下载方法见 http://www.linuxidc.com/Linux/2013-07/87684.htm

------------------------------------------分割线------------------------------------------

jQuery权威指南 PDF版中文+配套源代码 http://www.linuxidc.com/Linux/2013-10/91059.htm

jQuery实战 中文PDF+源码 http://www.linuxidc.com/Linux/2013-09/90631.htm

《jQuery即学即用(双色)》 PDF+源代码 http://www.linuxidc.com/Linux/2013-09/90383.htm

锋利的jQuery(第2版) 完整版PDF+源码 http://www.linuxidc.com/Linux/2013-10/91527.htm

jQuery完成带复选框的表格行高亮显示 http://www.linuxidc.com/Linux/2013-08/89406.htm

jQuery基础教程(第4版) PDF 完整高清版+配套源码 http://www.linuxidc.com/Linux/2014-03/98162.htm

--------------------------------------分割线 --------------------------------------

jQuery 的详细介绍:请点这里
jQuery 的下载地址:请点这里

本文永久更新链接地址:http://www.linuxidc.com/Linux/2014-08/105463.htm

linux
相关资讯       jQuery插件  jQuery placeholder 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款