html表单弹窗提示框,表单JS弹出填写提示效果代码

HTML

页面中的样式

.focus

{

border: 1px solid #FC0 !important;

background: url(Admin/Images/focus_bg.jpg) repeat-x !important;

color: #00F !important;

}

/*提示文字样式*/

#HintMsg

{

width: 271px;

position: absolute;

display: none;

}

#HintMsg .HintTop

{

height: 9px;

background: url(Admin/Images/hintbg1.gif) no-repeat;

overflow: hidden;

}

#HintMsg .HintInfo

{

padding: 0 5px;

border-left: 1px solid #000;

border-right: 1px solid #000;

background: #FFFFE1;

line-height: 1.5em;

}

#HintMsg .HintInfo b

{

display: block;

margin-bottom: 6px;

padding-left: 15px;

background: url(Admin/Images/hint.gif) left center no-repeat;

height: 13px;

line-height: 16px;

}

#HintMsg .HintInfo b span

{

display: block;

float: right;

text-indent: -9999px;

background: url(Admin/Images/close.gif) no-repeat;

width: 12px;

height: 12px;

cursor: pointer;

}

#HintMsg .HintFooter

{

height: 22px;

background: url(Admin/Images/hintbg2.gif) no-repeat;

}

关键JS

$(function() {

$(".input,.login_input,.textarea").focus(function() {

$(this).addClass("focus");

}).blur(function() {

$(this).removeClass("focus");

});

//输入框提示,获取拥有HintTitle,HintInfo属性的对象

$("[HintTitle],[HintInfo]").focus(function(event) {

$("*").stop(); //停止所有正在运行的动画

$("#HintMsg").remove(); //先清除,防止重复出错

var HintHtml = "

  • " + $(this).attr("HintTitle") + "" + $(this).attr("HintInfo") + "
"; //设置显示的内容

var offset = $(this).offset(); //取得事件对象的位置

$("body").append(HintHtml); //添加节点

$("#HintMsg").fadeTo(0, 0.85); //对象的透明度

var HintHeight = $("#HintMsg").height(); //取得容器高度

$("#HintMsg").css({ "top": offset.top - HintHeight + "px", "left": offset.left + "px" }).fadeIn(500);

}).blur(function(event) {

$("#HintMsg").remove(); //删除UL

});

});

效果图:

c60f42d914ed2f20276f5af78d718f2d.png

以上内容来子一个下载的网站,具体的名字忘记了....仅作参考

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值