jquery仿alert提示框、confirm确认对话框、prompt带输入的提示框插件实例演示

第一步:引入所需要的jquery插件文件:

http://www.angelweb.cn/Inc/eg/jquery.alerts.js

第二步:引入所需的样式:

#popup_container {font-family: Arial, sans-serif;font-size: 12px;min-width: 300px;max-width: 600px;background:#FFF;border:solid 5px #999;color:#000;-moz-border-radius:5px;-webkit-border-radius: 5px;border-radius: 5px;}
#popup_title {font-size:14px;font-weight:bold;text-align:center;line-height:1.75em;color:#666;background: #CCC url(/images/eg/title.gif) top repeat-x;border: solid 1px #FFF;border-bottom: solid 1px #999;cursor: default;padding:0em;margin:0em auto;}
#popup_content {background:16px 16px no-repeat url(/images/eg/info.gif);padding: 1em 1.75em;margin: 0em;}
#popup_content.alert {background-image: url(/images/eg/info.gif);}
#popup_content.confirm {background-image: url(/images/eg/important.gif);}
#popup_content.prompt {background-image: url(/images/eg/help.gif);}
#popup_message {padding-left: 48px;}
#popup_panel {text-align: center;margin:1em 0em 0em 1em;}
#popup_prompt {margin:.5em 0em;} 注意把上面样式中的图片先保存到本地,然后替换成自己的路径!

第三步:就可以直接引用了,看下面简单的实例:

$("#alert_button").click( function() {
jAlert('这是一个可自定义样式的警告对话框', '警告对话框');
}); $("#confirm_button").click( function(){
jConfirm('你确定这么做吗?', '确认对话框',function(r){
jAlert('是否确定 ' + r, '确定内容');
});
}); $("#prompt_button").click( function(){
jPrompt('输入字符:', '这里是默认值', '带输入框的提示框', function(r) {
if( r ){alert('你输入的是 ' + r)};
});
});
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>zhezhaoceng.html</title> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8"> <!--<link rel="stylesheet" type="text/css" href="./styles.css">-->
<script type="text/javascript" src="<%=contextPath %>/core/js/jquery/jquery-1.4.2.js"></script>
<script type="text/javascript" src="jquery.alerts.js"></script>
<style>
#popup_container {font-family: Arial, sans-serif;font-size: 12px;min-width: 300px;max-width: 600px;background:#FFF;border:solid 5px #999;color:#000;-moz-border-radius:5px;-webkit-border-radius: 5px;border-radius: 5px;}
#popup_title {font-size:14px;font-weight:bold;text-align:center;line-height:1.75em;color:#666;background: #CCC url(/images/eg/title.gif) top repeat-x;border: solid 1px #FFF;border-bottom: solid 1px #999;cursor: default;padding:0em;margin:0em auto;}
#popup_content {background:16px 16px no-repeat url(/images/eg/info.gif);padding: 1em 1.75em;margin: 0em;}
#popup_content.alert {background-image: url(/images/eg/info.gif);}
#popup_content.confirm {background-image: url(/images/eg/important.gif);}
#popup_content.prompt {background-image: url(/images/eg/help.gif);}
#popup_message {padding-left: 48px;}
#popup_panel {text-align: center;margin:1em 0em 0em 1em;}
#popup_prompt {margin:.5em 0em;}
</style>
<script type="text/javascript">
$("#alert_button").click( function() {
jAlert('这是一个可自定义样式的警告对话框', '警告对话框');
}); $("#confirm_button").click( function(){
jConfirm('你确定这么做吗?', '确认对话框',function(r){
jAlert('是否确定 ' + r, '确定内容');
});
}); $("#prompt_button").click( function(){
jPrompt('输入字符:', '这里是默认值', '带输入框的提示框', function(r) {
if( r ){alert('你输入的是 ' + r)};
});
}); </script>
</head> <body>
<div id="Con" class="ConDiv"> <fieldset>
<legend>警告提示框(Alert)</legend>
<pre> $("#alert_button").click( function() {
jAlert('这是一个可自定义样式的警告对话框', '警告对话框');
});
</pre>
<p>
<input id="alert_button" type="button" value="警告提示框">
</p>
</fieldset>
<script language="javascript">
$(function(){
$("#alert_button").click( function() {
jAlert('这是一个可自定义样式的警告对话框', '警告对话框');
});
});
</script> <fieldset>
<legend>确认对话框(Confirm)</legend>
<pre> $("#confirm_button").click( function(){
jConfirm('你确定这么做吗?', '确认对话框',function(r){
jAlert('是否确定 ' + r, '确定内容');
});
});
</pre>
<p>
<input id="confirm_button" type="button" value="确认对话框">
</p>
</fieldset>
<script language="javascript">
$(function(){
$("#confirm_button").click( function(){
jConfirm('你确定这么做吗?', '确认对话框',function(r){
jAlert('是否确定 ' + r, '确定内容');
});
});
});
</script> <fieldset>
<legend>带输入的提示框(Prompt)</legend>
<pre> jPrompt('输入字符:', '这里是默认值', '带输入框的提示框', function(r) {
if( r ) alert('你输入的是 ' + r);
});
</pre>
<p>
<input id="prompt_button" type="button" value="带输入框的提示框">
</p>
</fieldset>
<script language="javascript">
$(function(){
$("#prompt_button").click( function(){
jPrompt('输入字符:', '这里是默认值', '带输入框的提示框', function(r) {
if( r ){alert('你输入的是 ' + r)};
});
});
});
</script> <fieldset>
<legend>带HTML输出效果的对话框</legend>
<pre> jAlert('你可以使用HTML标签,比如 <strong>加粗</strong>, <em>斜体</em>,和 <u>下划线</u>!');
</pre>
<p>
<input id="alert_button_with_html" type="button" value="显示带有HTML标签效果的弹出框">
</p>
</fieldset>
<script language="javascript">
$(function(){
$("#alert_button_with_html").click( function(){
jAlert('你可以使用HTML标签,比如 <strong>加粗</strong>, <em>斜体</em>,和 <u>下划线</u>!');
});
});
</script>
</div>
</body>
</html>

jquery仿alert提示框、confirm确认对话框、prompt带输入的提示框插件[附实例演示]的更多相关文章

  1. 关于abp中使用的sweetalert对话框组件的confirm确认对话框中的一个坑

    今天修改了一个功能,限制删除用户,在删除的时候不满足条件的时候提示用户原因,使用的sweet alert组件. abp框架前端集成了sweet alert 对http请求的error做了全局处理,我在 ...

  2. confirm确认对话框

    还记得之前的javascript入门里的讲的confirm 消息对话框吗?不记得也没关系,我们先来回顾一下,然后在详细讲它. 复习: confirm 消息对话框通常用于允许用户做选择的动作,如:“你对 ...

  3. Unity3d UGUI 通用Confirm确认对话框实现(Inventory Pro学习总结)

    背景 曾几何时,在Winform中,使用MessageBox对话框是如此happy,后来还有人封装了可以选择各种图标和带隐藏详情的MessageBox,现在Unity3d UGui就没有了这样的好事情 ...

  4. asp.net在后台弹出confirm确认对话框并获取用户选择的值做出相应的操作

    在asp项目中,这种情况是经常出现的,前段时间通过查找资料以及自己尝试,找到一种解决方案,但是不知是否有更好的方案,以后发现再进行记录. 一.思路 在本次项目中,在一个函数中需要让用户判断,并根据用户 ...

  5. BootstrapDialog.confirm确认对话框

    1. 依赖文件: bootstrap.js bootstrap-dialog.js bootstrap.css bootstrap-dialog.css 2.代码 BootstrapDialog.co ...

  6. 15 JavaScript弹窗(警告框alert、确认框confirm、提示框Promt)

    警告框:window.alert().通常用于确认用户可以得到某些信息 <body> <script type="text/javascript" charset ...

  7. Selenium系列(九) - 针对alert窗口的处理(警告框、确认框、对话框)

    如果你还想从头学起Selenium,可以看看这个系列的文章哦! https://www.cnblogs.com/poloyy/category/1680176.html 其次,如果你不懂前端基础知识, ...

  8. jquery easy ui 1.3.4 窗口,对话框,提示框(5)

    5.1.window(窗口) 窗口我们在程序中会大量的使用,比如我们的添加.编辑都可以使用窗口实现,与winform的程序非常的类似.下面的代码是创建一个基本的窗口 $(function () { $ ...

  9. jquery mobile 实现自定义confirm确认框效果

    类似删除的效果,在执行之前,一般需要添加确认对话框,点确认的话执行,取消按钮就不执行,传统的js if(confirm('确定删除吗?')) { //执行代码 } 这种效果比较丑,使用jquery m ...

随机推荐

  1. Integer跟int的区别(备份回忆)

    int与Integer的区别 int 是基本数据类型Integer是其包装类,注意是一个类.为什么要提供包装类呢???一是为了在各种类型间转化,通过各种方法的调用.否则 你无法直接通过变量转化.比如, ...

  2. 学习笔记_Java_day12_设计模式MVC(13).JavaWeb的三层框架(14)

    MVC 1. 什么是MVC MVC模式(Model-View-Controller)是软件工程中的一种软件架构模式,把软件系统分为三个基本部分:模型(Model).视图(View)和控制器(Contr ...

  3. Entity Framework 使用sql语句分页(查询单表)

    1.查询单表 var pageSize = 2;//条数 var pageIndex = 2;//索引 var sql = @" SELECT D.* FROM ( SELECT ROW_N ...

  4. QT 自定义assert

    预览 代码 #define assert_(expression,message) if (expression) \ { \ if (QMessageBox::Yes == QMessageBoxE ...

  5. 设计模式之开篇(C#语法)

    很长时间没有写文章了,前段时间写的C#语法糖分享得到有很多朋友支持,这个也使得我有信心继续分享下去,在这里非常感谢大家!这次开始给大家分享一下设计模式,我个人觉得设计模式也对于我们提高个人技术水平来说 ...

  6. nginx 限制及指定IP或IP段访问

    nginx 限制及指定IP或IP段访问. location / { deny 192.168.1.1; allow ; allow ; deny all; } 企业问题案例:Nginx做反向代理的时候 ...

  7. centOS 6 python MySQLdb 提示 no module

    http://www.cnblogs.com/czh-liyu/archive/2012/11/30/2796028.html(转) 用python连接本地数据库时,提示no module MySQL ...

  8. sar监控系统状态

    sar 命令很强大,它可以监控系统所有资源状态,比如平均负载.网卡流量.磁盘状态.内存使用等等. 它不同于其他系统状态监控工具的地方在于,它可以打印历史信息,可以显示当天从零点开始到当前时刻的系统状态 ...

  9. Shell数组

    #!/bin/bash#数组的使用#数组赋值方式:#1. user[index]=value index为0,1,2,3,4....数组下标值#2. user=(value0 value1 value ...

  10. IE11的CSS兼容性问题

    最近测试给了我一大堆BUG,一瞅发现全是IE11的.吐槽一下这个浏览器真的比较特立独行.很多默认的样式跟别的浏览器不同,而且最明显的一点应该是padding左右内边距往往比别的浏览器大了一倍.但是当需 ...