日期:2014-05-16 浏览次数:20403 次
<div id="regCover">
<div id="regForm">
<form class="cl_form" method="post">
<p>
<input type="text" value="密码" id="password1" class="cl_regPwd"/>
<input name="password" type="password" prompt="请设置6-18位由a-z0-9A-Z字符组成的密码!" id="password2" style="display:none;" class="cl_regPwd"/>
</p>
<p>
<input type="text" value="确认密码" id="password3" class="cl_regPwd1"/>
<input type="password" prompt="请再次输入相同的密码!" id="password4" style="display:none;" class="cl_regPwd1"/>
</p>
</form>
</div>
</div>
//表单操作
jQuery(document).ready(function($){
/*为密码输入框添加提示信息*/
getFocus("#password1","#password2");
getFocus("#password3","#password4");
blurFocus("#password2","#password1");
blurFocus("#password4","#password3");
/*显示提示框*/
function showTooltip(node,property){
$('<div id="myToolTip"><div class="triangle" /></div>')
.insertAfter(node)
.prepend($(node).attr(property));
var offset = $(node).offset();
$("#myToolTip").css({"left":$(node).width(),"top":offset.top-140,"display":"block"});
//alert("aaa?");
}
/*删除提示框*/
function delTooltip(){
$("#myToolTip").remove();
}
function getFocus(focusNode,triggerNode){
$(focusNode).focus(function(){
$(this).hide();
$(triggerNode).show();
$(triggerNode).focus();
//blurFocus(triggerNode,focusNode);
}).blur(function(){
delTooltip();
});
}
/*密码输入框的提示--逻辑*/
function blurFocus(focusNode,triggerNode) {
$(focusNode).focus(function (event) {
//alert("OK");
showTooltip(focusNode,"prompt");
}).blur(function(){
if($(this).val()==''){
$(triggerNode).show();
$(this).hide();
}else{
//alert("reg validate--------pwd1!");
}
delTooltip();
});
}