jquery仿alert提示框、confirm确认对话框、prompt带输入的提示框插件[附实例演示]
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带输入的提示框插件[附实例演示]的更多相关文章
- 关于abp中使用的sweetalert对话框组件的confirm确认对话框中的一个坑
今天修改了一个功能,限制删除用户,在删除的时候不满足条件的时候提示用户原因,使用的sweet alert组件. abp框架前端集成了sweet alert 对http请求的error做了全局处理,我在 ...
- confirm确认对话框
还记得之前的javascript入门里的讲的confirm 消息对话框吗?不记得也没关系,我们先来回顾一下,然后在详细讲它. 复习: confirm 消息对话框通常用于允许用户做选择的动作,如:“你对 ...
- Unity3d UGUI 通用Confirm确认对话框实现(Inventory Pro学习总结)
背景 曾几何时,在Winform中,使用MessageBox对话框是如此happy,后来还有人封装了可以选择各种图标和带隐藏详情的MessageBox,现在Unity3d UGui就没有了这样的好事情 ...
- asp.net在后台弹出confirm确认对话框并获取用户选择的值做出相应的操作
在asp项目中,这种情况是经常出现的,前段时间通过查找资料以及自己尝试,找到一种解决方案,但是不知是否有更好的方案,以后发现再进行记录. 一.思路 在本次项目中,在一个函数中需要让用户判断,并根据用户 ...
- BootstrapDialog.confirm确认对话框
1. 依赖文件: bootstrap.js bootstrap-dialog.js bootstrap.css bootstrap-dialog.css 2.代码 BootstrapDialog.co ...
- 15 JavaScript弹窗(警告框alert、确认框confirm、提示框Promt)
警告框:window.alert().通常用于确认用户可以得到某些信息 <body> <script type="text/javascript" charset ...
- Selenium系列(九) - 针对alert窗口的处理(警告框、确认框、对话框)
如果你还想从头学起Selenium,可以看看这个系列的文章哦! https://www.cnblogs.com/poloyy/category/1680176.html 其次,如果你不懂前端基础知识, ...
- jquery easy ui 1.3.4 窗口,对话框,提示框(5)
5.1.window(窗口) 窗口我们在程序中会大量的使用,比如我们的添加.编辑都可以使用窗口实现,与winform的程序非常的类似.下面的代码是创建一个基本的窗口 $(function () { $ ...
- jquery mobile 实现自定义confirm确认框效果
类似删除的效果,在执行之前,一般需要添加确认对话框,点确认的话执行,取消按钮就不执行,传统的js if(confirm('确定删除吗?')) { //执行代码 } 这种效果比较丑,使用jquery m ...
随机推荐
- css position 定位
fixed 属于绝对定位,相对于浏览器窗口定位 (IE 6不支持) relative 相对定位,通过设置垂直或水平位置,让这个元素"相对于"它的原始起点进行移动. ...
- Integer跟int的区别(备份回忆)
int与Integer的区别 int 是基本数据类型Integer是其包装类,注意是一个类.为什么要提供包装类呢???一是为了在各种类型间转化,通过各种方法的调用.否则 你无法直接通过变量转化.比如, ...
- (转)Eclipse中junit框架的使用——单元测试
[转]junit浅学笔记一 JUnit是一个回归测试框架(regression testing framework).Junit测试是程序员测试,即所谓白盒测试,因为程序员知道被测试的软件如何(How ...
- html5 video.js 使用及兼容所有浏览器
废话少说,直接开始 一.准备材料 video.js下载: http://www.videojs.com/ 二.代码 引入相关文件:(必须放在文件的开头,也是说一定要放在video标签之前) 贴入htm ...
- mvc Routing特性优化
在mvc中,Url地址是利用routing特性来支持,但是这个Routing有个问题,多个不同的地址和指向同一个action方法, 例如: http://test.com (默认) http://te ...
- MVC中使用jquery的浏览器缓存问题
jquery在浏览器ajax调用的时候,对缓存提供了很好的支持,POST方式不能被缓存,使用POST的原因,明确了数据不能被缓存,或者避免JSON攻击(JSON返回数据的时候可以被入侵) jquery ...
- ISA2006 下建立VPN连接时出现“错误800”时的解决办法
[转载]http://social.microsoft.com/Forums/zh-CN/9cfa0c06-0f46-44cb-9e8f-8eba1c3821ba/vpn-vpn800 重启Routi ...
- == 和 equals()的区别
package com.liaojianya.chapter1; /** * This program demonstrates the difference between == and equal ...
- 【失败】制作CentOS镜像
1.在vmware上安装centos虚拟机,安装过程中设置CPU时,点选 虚拟化Intel VT-x~ 和 虚拟化CPU性能计数器,网络使用NAT模式 2.#mkdir /opt/iso,上传镜像(用 ...
- mysql添加超级管理员
mysql>create user 'myroot'@'localhost' identified by 'myroot'; mysql>grant all privileges on * ...