dialog()又不解的地方。求大神.
<!DOCTYPE html>
<html>
<head>
? ? <meta charset="utf-8">
? ? <title>對話框插件</title>
? ? <style type="text/css">
? ? ? ? body
? ? ? ? {
? ? ? ? ? ? font-size: 62.5%;
? ? ? ? }
? ? ? ? #divtest
? ? ? ? {
? ? ? ? ? ? width: 282px;
? ? ? ? }
? ? ? ? #divtest .content
? ? ? ? {
? ? ? ? ? ? background-color: #eee;
? ? ? ? ? ? padding: 8px;
? ? ? ? ? ? height: 23px;
? ? ? ? ? ? line-height: 23px;
? ? ? ? }
? ? ? ? .fl
? ? ? ? {
? ? ? ? ? ? float: left;
? ? ? ? }
? ? ? ? .fr
? ? ? ? {
? ? ? ? ? ? float: right;
? ? ? ? }
? ? </style>
? ? <link rel="stylesheet" >
? ? <script src="http://idcbgp.cn/data/jquery-1.8.2.min.js" type="text/javascript"></script>
? ? <script src="http://idcbgp.cn/data/jquery-ui-1.9.2.min.js" type="text/javascript"></script>
</head>
<body>
<div id="divtest">
? ? <div class="content">
? ? ? ? <span id="spnName" class="fl">張三</span>
? ? ? ? <input id="btnDelete" type="button" value="刪除" ?class="fr"/>
? ? </div>
? ? <div id='dialog-modal'></div>
</div>
<script type="text/javascript">
? ? $(function () {
? ? ? ? $("#btnDelete").bind("click", function () { //詢問按鈕事件
? ? ? ? ? ? if ($("#spnName").html() != null) { //如果對象不為空
? ? ? ? ? ? ? ? sys_Confirm("您真的要刪除該條記錄嗎?");
? ? ? ? ? ? ? ? return false;
? ? ? ? ? ? }
? ? ? ? });
? ? });
? ? function sys_Confirm(content) { //彈出詢問信息窗口
? ? ? ? $("#dialog-modal").dialog({
? ? ? ? ? ? height: 140,
? ? ? ? ? ? modal: true,
? ? ? ? ? ? title: '系統(tǒng)提示',
? ? ? ? ? ? hide: 'slide',
? ? ? ? ? ? buttons: {
? ? ? ? ? ? ? ? '確定': function () {
? ? ? ? ? ? ? ? ? ? $("#spnName").remove();
? ? ? ? ? ? ? ? ? ? $(this).dialog("close");
? ? ? ? ? ? ? ? },
? ? ? ? ? ? ? ? '取消': function () {
? ? ? ? ? ? ? ? ? ? $(this).dialog("close");
? ? ? ? ? ? ? ? }
? ? ? ? ? ? },
? ? ? ? ? ? open: function (event, ui) {
? ? ? ? ? ? ? ? $(this).html("");
? ? ? ? ? ? ? ? $(this).append("<p>" + content +"aa"+ "</p>");
? ? ? ? ? ? }
? ? ? ? });
? ? }
</script>
</body>
</html>
2018-09-14
sys_Confirm()是他自定義的一個函數(shù),content是里面的形參,"您真的要刪除該條記錄嗎?"就等于函數(shù)里的content。
2018-06-07
content是sys_Confirm的參數(shù),這個參數(shù)上面已經定義了是("您真的要刪除該條記錄嗎?")
buttons就是按鈕,兩個按鈕分別執(zhí)行不同的數(shù)據(jù)
2018-04-24
sys_Confirm("您真的要刪除該條記錄嗎?");
自定義函數(shù),(參數(shù)),提前調用。
2018-04-24
return false;阻止后面相關的所有事件的的動作和行為,及冒泡事件和劉瀏覽器默認行為,和eventpreventDefaule一樣,并功能更強大。