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