Posted in Javascript onOctober 09, 2010
下载JS文件引用到page中,如下代码:
<!-- Dependencies --> <script src="/path/to/jquery.js" type="text/javascript"></script> <script src="/path/to/jquery.ui.draggable.js" type="text/javascript"></script> <!-- Core files --> <script src="/path/to/jquery.alerts.js" type="text/javascript"></script> <link href="/path/to/jquery.alerts.css" rel="stylesheet" type="text/css" media="screen" />
注意其中draggable是用来实现拖拉的,如不需要这个功能不就不用引用。在目前最近的Jquery1.42下应用引用:
<script src="Scripts/jquery-1.4.2.min.js" type="text/javascript"></script> <script src="Scripts/jquery-ui-1.8.5.custom.min.js" type="text/javascript"></script> <script src="Scripts/jquery.alerts.js" type="text/javascript"></script> <link href="Content/Style/jquery.alerts.css" rel="stylesheet" type="text/css" />
主要方法有:
jAlert(message, [title, callback]) 创建一个alert
jConfirm(message, [title, callback]) 创建一个确认allert,支持callback
jPrompt(message, [value, title, callback]) 创建一个提示框让用户输入值,支持callback如果你有提供
可以参下面的示例Code:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Defualt.aspx.cs" Inherits="WebApplication6.Defualt" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head id="Head1" runat="server"> <title></title> <script src="Scripts/jquery-1.4.2.min.js" type="text/javascript"></script> <script src="Scripts/jquery-ui-1.8.5.custom.min.js" type="text/javascript"></script> <script src="Scripts/jquery.alerts.js" type="text/javascript"></script> <link href="Content/Style/jquery.alerts.css" rel="stylesheet" type="text/css" /> <script type="text/javascript"> $(document).ready(function () { $("#btnAlert").click(function () { jAlert('Pushed the alert button', 'Alert Dialog'); }); $("#btnPrompt").click(function () { jPrompt('Type some value:', '', 'Prompt Dialog', function (typedValue) { if (typedValue) { jAlert('You typed the following ' + typedValue); } }); }); }); </script> </head> <body> <form id="form1" runat="server"> <div> <input type="button" value="Alert Me" id="btnAlert" /> <input type="button" value="Prompt Me" id="btnPrompt" /> </div> </form> </body> </html>
最后alert效果图:
打包下载地址 https://3water.com/jiaoben/32367.html
JQuery的Alert消息框插件使用介绍
声明:登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述。
Reply on: @reply_date@
@reply_contents@