兼容ie6/7/8、firefox2/3、Opera、safari;
字体颜色和大小可以任意修改;
JQ代码
$("#name").fmTitle({
style:"yellow",
color:"#757168",
size:"12px"
});
<img src="images/dengpao.gif" align="absmiddle" id="name" content="填写你的姓名,最少要填2个汉字,最多只能填写8个汉字" />
解释
style:默认风格是yellow 可选择 yelow,red。
color:提示框里面字体颜色。
size:提示框里面字体大小。
本例完整代码
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<link rel="stylesheet" href="css/fm.css" type="text/css" charset="utf-8" title="main" />
<title></title>
<script src="js/jquery-1.4.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.7.2.custom.min.js"></script>
<script src="js/jquery.fm.js"></script>
<script language="javascript">
$().ready(function(){
$("#name").fmTitle({
style:"yellow",
color:"#757168",
size:"12px"
});
$("#email").fmTitle({
style:"red",
color:"#757168",
size:"12px"
});
})
</script>
</head>
<body >
<div id="main">
<h3> </h3>
<div class="div">
<p>
姓名:<input name="Input2" type="text" style="width:100px" class="input_text_link" οnmοuseοver="this.className='input_text_hover'" οnmοuseοut="this.className='input_text_link'" /> <img src="images/dengpao.gif" align="absmiddle" id="name" content="填写你的姓名,最少要填2个汉字,最多只能填写8个汉字" /><br /><br />
邮箱:<input name="Input2" type="text" style="width:100px" class="input_text_link" οnmοuseοver="this.className='input_text_hover'" οnmοuseοut="this.className='input_text_link'" /> <img src="images/dengpao.gif" class="title" id="email" content="电子邮箱的正确格式是:用户名@域名,例如hu@corange.cn或huadoocn@corange.cn等形式" /><br /><br />
</p>
</div>
</div>
</body>
</html>
专用JS文件
http://www.corange.cn//uploadfiles/js0806_22579.rar
原文地址: http://www.corange.cn/archives/2010/08/3676.html