闲的蛋疼,演示一下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>
<input type="text" id="userName" name="userName" placeholder="请输入username…" 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两个文件,这两个文件可在以下的下载资源中找到。

0分下载资源

Jquery插件placeholder的用法的更多相关文章

  1. jQuery插件placeholder的使用方法

    借助该插件可以轻松实现HTML5中placeholder特效: 实例代码如下: <script type="text/javascript" src="<%= ...

  2. jquery插件之jquery.extend和jquery.fn.extend的区别

    jquery.extend jquery.extend(),是拓展jquery这个类,即可以看作是jquery这个类本身的静态方法,例如: <!DOCTYPE html> <html ...

  3. 解决HTML5中placeholder属性兼容性的JQuery插件

    //调用方法 $(function () {   $(".pHolder").jason(); }); //HTML代码 <input type="text&quo ...

  4. jQuery插件制作之全局函数用法实例

    原文地址:http://www.jb51.net/article/67056.htm 本文实例讲述了jQuery插件制作之全局函数用法.分享给大家供大家参考.具体分析如下: 1.添加新的全局函数 所谓 ...

  5. 跨浏览器实现placeholder效果的jQuery插件

    曾经遇到这样一个问题,处理IE8密码框placeholder属性兼容性.几经周折,这个方案是可以解决问题的. 1.jsp页面引入js插件 <script type="text/java ...

  6. 实用的placeholder插件,兼容IE下的placeholder,jquery插件

    placeholder在IE下无法兼容 ,下面的插件很好的处理了这个问题,拿去不谢 /* * jQuery placeholder, fix for IE6,7,8,9 * @website itmy ...

  7. JQuery插件之Jquery.datatables.js用法及api

    1.DataTables的默认配置 $(document).ready(function() { $('#example').dataTable(); } ); 示例:http://www.guoxk ...

  8. jquery插件Flot的简单讲解

    只是说一下基本用法,举一两个例子,详细用法请查看官方文档 使用方法是要先引入jquery插件,然后引入flot插件. <script type="text/javascript&quo ...

  9. html select美化模拟jquery插件select2.js

    代码展示:http://www.51xuediannao.com/demo.php 代码说明: select2.js是一个html select美化模拟类jquery插件,但是select2.js又远 ...

随机推荐

  1. QT使用scrollarea显示图片,完美解决方案

    需求: 在界面上点击“显示图片”按钮,会调用scrollarea窗口显示图片,窗口大小能根据图片大小自动调整,但是最大为1024*768,图片过大就要有滚动条来显示 IDE环境: QT Creator ...

  2. php语言基础学习笔记

    花了一个小时复习了一下很多年没有碰了的php,mark一下,高二时学的. 1. 代码嵌在<?php  ?>内 2.输出函数echo,相当于js中的document.write 3.可以在打 ...

  3. 499 - What's The Frequency, Kenneth?

     What's The Frequency, Kenneth?  #include <stdio.h> main() { int i; char *suffix[]= { "st ...

  4. appium 真机测试问题 出现 instruments crashed on startup

    1.appium 真机测试的时候 instruments crashed on startup,必须在真机上打开UI Automation 在设置里: Developer->Enable UI ...

  5. linux 解压操作命令

    http://apps.hi.baidu.com/share/detail/37384818 download ADT link http://dl.google.com/android/ADT-0. ...

  6. 利用ScktSrvr打造多功能Socket服务器

    Socket服务端编程中最重要的也是最难处理的工作便是客户请求的处理和数据的接收和发送,如果每一个Socket服务器应用程序的开发都要从头到尾处理这些事情的话,人将会很累,也会浪费大量时间.试想,如果 ...

  7. 【状态DP】 HDU 1074 Doing Homework

    原题直通车:HDU  1074  Doing Homework 题意:有n门功课需要完成,每一门功课都有时间期限t.完成需要的时间d,如果完成的时间走出时间限制,就会被减 (d-t)个学分.问:按怎样 ...

  8. [LeetCode] Unique Paths 2

    Follow up for "Unique Paths": Now consider if some obstacles are added to the grids. How m ...

  9. OSX: 使用命令行对FileVault2分区恢复

    FileVault 2必须有Recovery HD分区,因为它依赖于它作为系统初启动.如果今后什么时候或者误操作删除了Recovery HD分区,那么你的机器就无法启动鸟. 是否使用苹果的办法重新获得 ...

  10. RTSP 消息拼装实例代码

    整理了下之前文章提到的RTSP实例的代码,主要是拼装各类消息字段. 首先,抽取一个公共函数,用来根据消息类型,生成不同的format,供sprintf试用. char * GetRTSPCmd( co ...