function selfAlert(msgstr,timer) { var alertValue = 0; var h = screen.availHeight; var w = screen.availWidth; var dv = document.createElement("div"); dv.setAttribute('id','bg'); dv.style.height = h + "px"; dv.style.width = w + "px"; dv.style.zIndex = "1111"; dv.style.top = 0; dv.style.left = 0; dv.style.background = "#fff"; dv.style.filter = "alpha(opacity=0)"; dv.style.position = "absolute"; document.body.appendChild(dv); var dvMsg = document.createElement("div"); dvMsg.style.position = "absolute"; dvMsg.setAttribute('id','msg'); dvMsg.style.width = "140px"; dvMsg.style.height = "50px"; dvMsg.style.top="30%"; dvMsg.style.left="40%"; dvMsg.style.background = "white"; dvMsg.style.zIndex = "1112"; strHtml = "<table width='200' height='25' border='0' cellspacing='0' cellpadding='0' align='center'>" strHtml += " <tr height='25' style='line-height:25px;'>" strHtml += " <td width='250' title='移动' style='cursor:move;background:#CFD7EC url(title_bg_left.gif) no-repeat top left;' onmousedown='oMove(parentNode.parentNode.parentNode.parentNode);'>" strHtml += " <font style='font-size:12px;font-weight:bold;color:#000;margin-left:10px;'>消息提示框</font></td>" strHtml += " <td width='30' style='background:#CFD7EC url(title_bg_right.gif) no-repeat right top;'>" strHtml += " <img src='close.gif' style='margin-right:3px;cursor:hand;' onclick='imgClose();'><td></tr>" strHtml += "</table>" strHtml += "<table width='200' height='50' border='0' cellspacing='0' cellpadding='0' align='center' style='border:1px solid #343434'>" strHtml += " <tr height='50' bgcolor='#F4F4F4'><td width='' style='padding-left:10;'></td>" strHtml += " <td width='200' align='center'>" + msgstr + "</td></tr>" strHtml += " <tr height='27'><td colspan='2' style='background:#F4F4F4;padding-top:0px;' valign='top' align='center'>" strHtml += " <input type='button' value='确 定' style='width:70;' onclick='btnclick()'></td></tr>" strHtml += "</table>" dvMsg.innerHTML = strHtml; document.body.appendChild(dvMsg); imgClose = function (){ alertValue = 2; document.body.removeChild(dv); document.body.removeChild(dvMsg); }; btnclick = function (){ alertValue = 1; document.body.removeChild(dv); document.body.removeChild(dvMsg); }; remove = function () { if(alertValue==0){ document.body.removeChild(dv); document.body.removeChild(dvMsg); } }; setTimeout("remove()",timer); oMove = function(obj) { var otop,oleft; otop = event.y - obj.offsetTop; oleft = event.x - obj.offsetLeft; obj.setCapture(); obj.onmousemove = function() { obj.style.left = event.x - oleft; obj.style.top = event.y - otop; }; obj.onmouseup = function() { obj.onmousemove = null; obj.style.filter = null; obj.releaseCapture(); }; }; };
相关推荐
有时候感觉系统自带的提示框太丑了,试试自定义提示框吧,直接引用js即可
有时候感觉系统自带的提示框太丑了,试试jquery自定义提示框吧,可以自适应手机,要先引用jquery
Winform自定义消息框,好看的消息提示Alert源码,国外大神,很基础的实现,可以在此基础上进行优化和进一步调整。Winform控件、Winform优美提示框、消息框、Alert信息弹窗、Notification
自定义弹出窗口和遮挡层,效果还不错,附带demo实例
jquery模拟alert提示框 一个自定义函数
对UIAlertView进行简单的扩展封装,实用block块的方式回调用户的点击操作。定义了三种样式:普通提示框、不带取消按钮的提示框、带输入框的提示框。注释详尽,方便大家学习。
完全javascript制作 WEB自定义提示框 警告框 可输入文本框
Js封装版网页提示框插件,这里面是一些前端开发常用的提示框插件,比如Alert警告框、Confirmation弹出确认框、Prompt带输入内容的确认框、Custom Popup自定义的弹出消息框、Auto Close自动关闭的弹出框、Async ...
自定义弹出框,包括alert弹出框、confirm弹出选择框、show消息提示框、dialog操作弹出框;
对JavaScript中的alert confirm wait 美化,并能返回原来的true false值。
SweetAlert可以替代Javascript原生的alert和confirm等函数呈现的弹出提示框,它将提示框进行了美化,并且允许自定义,支持设置提示框标题、提示类型、内容展示图片、确认取消按钮文本、点击后回调函数等。
一个提示框,比系统的更美观.灰色部分可防止点击. 其实就是一个文件,(.h,.m,.xib)调用时 #import "LWAlertView.h" LWAlertView *quit=[LWAlertView alertViewWithWarnTitle:@"你确定要如此操作?"]; [self.view ...
自定义简单弹出框Dialog辅助工具类 Alert实现弹出框加载XML或者视图VIEW
脚本资源,jQuery,提示框,jQuery插件,Confirm jQuery Alert Dialogs,又一个基于jQuery的提示框插件,主要包括Alert、Confirm、prompt这三种,还有一个高级范例,可以在提示框内嵌入HTML语言,可以自定义风格样式。...
可以直接调用,操作方便,调用代码如下: jConfirm('Can you confirm this,<span am red.</span>?', 'Confirmation Dialog', function(r) { });
最近在学习iOS开发,在牛刀小试的时候发现系统的UIAlertView有点不喜欢,然后就自己自定义了一个UIAlertView,基本上实现了系统的UIAlertView,可以根据项目的需求修改UIAlertView的颜色。有需要的朋友们可以参考借鉴...
下面小编就为大家带来一篇修改js confirm alert 提示框文字的简单实例。小编觉得挺不错的,现在就分享给大家,也给大家做个参考。一起跟随小编过来看看吧
php自定义函数之简单提示框alert,方便输出提示信息。