easyUI之Messager(訊息視窗)
阿新 • • 發佈:2018-12-04
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Messager(訊息視窗)</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" href="../themes/default/easyui.css" type="text/css"></link> <link rel="stylesheet" href="../themes/icon.css" type="text/css"></link> <script type="text/javascript" src="../js/jquery.min.js"></script> <script type="text/javascript" src="../js/jquery.easyui.min.js"></script> <script type="text/javascript" src="../js/easyui-lang-zh_CN.js"></script> </head> <body> <input type="button" value="警告框"/><br/> <input type="button" value="確認框"/><br/> <input type="button" value="輸入框"/><br/> <input type="button" value="顯示框"/><br/> <div style="margin:100px"></div> <script type="text/javascript"> //定位所有的button按鈕,同時提供單擊事件 $(":button").click(function(){ //獲取value屬性值 var tip = $(this).val(); //去空格 tip = $.trim(tip); //如果警告框的話 if("警告框" == tip){ $.messager.alert("警告框","繼續努力","warning",function(){ alert("關閉"); }); }else if("確認框" == tip){ $.messager.confirm("確認框","你確認要關閉該確認框嗎?",function(value){ alert(value); }); }else if("輸入框" == tip){ $.messager.prompt("輸入框","你期希的月薪是多少?",function(sal){ if(sal == undefined){ alert("請輸入月薪"); }else{ if(sal<6000){ alert("你的謙虛了"); }else if(sal < 7000){ alert("你加點油了"); }else{ alert("你很不錯了"); } } }); }else if("顯示框" == tip){ $.messager.show({ showType : "slide", showSpeed : 500, width : 300, height : 300, title : "顯示框", msg : "這是內容", timeout : 5000 }); } }); </script> </body> </html>