下载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” />
<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” />
<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” “https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=”https://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>
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=”https://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效果图:
打包下载地址 /jiaoben/32367.html
—-想了解更多的jquery相关特效编写怎么解决关注<计算机技术网(www.ctvol.com)!!>
本文来自网络收集,不代表计算机技术网立场,如涉及侵权请联系管理员删除。
ctvol管理联系方式QQ:251552304
本文章地址:https://www.ctvol.com/jquerytutorial/89727.html