通行证: 密码: 保存密码
收藏 帮助

嘿嘿~~~~


标签: js

//**自己写的确认框,用法:事件中调用show_confirm('func_name()','tip_info'),并且func_name函数后要调用hide_confirm();
function show_confirm(callback,tips){
 if(document.getElementById('_shield'))
  return;
 var oDiv = document.createElement('div');
 var domBody = document.documentElement?document.documentElement:document.body;
 document.body.appendChild(oDiv);
 oDiv.setAttribute('id','_shield');
 oDiv.style.position = 'absolute';
 oDiv.style.left = '0px';
 oDiv.style.top  = '0px';
 oDiv.style.width  = domBody.scrollWidth  + 'px';
 oDiv.style.height = domBody.scrollHeight + 'px';
 oDiv.style.backgroundColor = '#888';
 oDiv.style.filter  = "alpha(opacity=50)";
 oDiv.style.opacity = 0.5;
 var left_scroll = domBody.scrollLeft; //滚动条卷去的宽度
 var top_scroll = domBody.scrollTop;  //滚动条卷去的高度
 var width_view = domBody.clientWidth; //正文可见宽度
 var height_view = domBody.clientHeight; //正文可见高度
 var l = left_scroll + (width_view-260)/2;
 var t = top_scroll + (height_view-180)/2
 var tip = tips?tips:'';
 $(document.body).append('<div class="clue_to" id="_confirm"><p class="color1">确定要删除吗?</p><p class="color2">'+tip+'</p><p><input class="btncm btnok" value="确 定" type="button" onclick="'+callback+'" />&nbsp;&nbsp;<input class="btncm btncc" value="取 消"  type="button" onclick="hide_confirm()" /></p></div>');
 document.getElementById('_confirm').style.left = l + 'px';
 document.getElementById('_confirm').style.top  = t + 'px';
}
function hide_confirm(){
 document.getElementById('_shield').parentNode.removeChild(document.getElementById('_shield'));
 document.getElementById('_confirm').parentNode.removeChild(document.getElementById('_confirm'));
}


CSS:

/*日志删除确认提示框*/
.clue_to{
 width:260px;
 position:absolute;
 padding:18px 0px 0px 0px;
 border:1px solid #ddd;
 text-align:center;
 background:#fff;
}
.clue_to p input{
 width:80px;
 height:26px;
}
.clue_to p{
 margin-bottom:18px;
}
.clue_to p.color1{
 font-size:16px;
 font-weight:bold;
}
.clue_to p.color2{
 font-size:14px;
 color:#3366CC;
}


推荐到博客首页 (0) |  复制链接 |  评论: 4 |  阅读: 862 |  个人分类: 技术 |  系统分类: 工作•职业•资料•技术 |  发表于: 2008.02.20 08:54

评论


 回复 发布者:那一抹微笑
2007-12-12 16:36
这东东俺不懂!

 回复 发布者:小潴
2007-12-12 15:11
这些代码是用在哪里的

 回复 发布者:safer
2007-12-06 17:32
有没博客皮肤的~~

 回复 发布者:春光明媚(^o^)/~
2007-12-06 09:45
我的天啊,头晕目眩

表情 超链接
操作中,请等待...