Introduction to JQuery's Alert message box plug-in

Source: Internet
Author: User

Download the JS file and reference it to the page. The Code is as follows:
Copy codeThe Code is as follows:
<! -- 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"/>

Note that draggable is used to implement drag. If you do not need this function, you do not need to reference it. In the latest Jquery1.42 application reference:
Copy codeThe Code is as follows:
<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"/>

The main methods are as follows:
JAlert (message, [title, callback]) creates an alert
JConfirm (message, [title, callback]) creates a confirmation allert and supports callback
JPrompt (message, [value, title, callback]) creates a prompt box for users to enter a value. callback is supported.
The following sample Code can be used:
Copy codeThe Code is as follows:
<% @ 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>

Finally, alert:
 
Packaging http://www.jb51.net/jiaoben/32367.html

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.