国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 網站 > 建站經驗 > 正文

方維中的彈出對話框的使用即weeboxs 的基本應用

2024-04-25 20:44:45
字體:
來源:轉載
供稿:網友
方維分享系統中的彈出對話框,用的是weeboxs ,這個用著很不錯,下面總結下weeboxs 基本參數及用法
使用前需包含以下jquery.js、bgiframe.js、weebox.js、weebox.css文件,這個方維都包含的有了。
boxid: null, //設定了此值只后,以后在打開同樣boxid的彈窗時,前一個將被自
動關閉
boxclass: null, //給彈窗設置其它的樣式,用此可以改變彈窗的樣式
type: 'dialog', //彈窗類型,目前有dialog,error,warning,success,wee,prompt,
box六種
title: '', //彈窗標題
width: 0, //彈窗寬度,不設時,會自動依據內容改變大小
height: 0, //彈窗高度(注意是內容的高度,不是彈窗的高度)
timeout: 0, //自動關閉的秒數,設置此值后,窗口將自動關閉
draggable: true,//是否可以拖拽
modal: true, //是否顯示遮照
overlay: 75, //遮照透明度
focus: null, //彈窗打開后,焦點移到什么元素上,默認移到取消按鈕到
position: 'center',//彈窗打開后的默認為中間,設置為element時,需要設置
trager選項,
trigger: null, //顯示位置的參照元素,為一個元素id
showTitle: true,//是否顯示標題
showButton: true,//是否顯示按鈕,包括確定和取消
showCancel: true, //是否顯示取消按鈕
showOk: true, //是否顯示確定按鈕
okBtnName: '確定',//"確定"按鈕名稱
cancelBtnName: '取消',//"取消"按鈕名稱
contentType: 'text',//內容獲取方式,目前有三種text,selector,ajax
contentChange: false,//為selector時
clickClose: false, //點擊不在彈窗上時,是否關閉彈窗
zIndex: 999,//默認彈窗的層
animate: false,//效果顯示
onclose: null, //彈窗關閉時觸發的函數
onopen: null, //彈窗顯示前觸發的函數, 此時內容已經放入彈窗中,不過還沒有顯示出來
onok: null ,//點擊確定按鈕后
oncancel:null //點擊取消按鈕觸發函數
$.weeboxs.open('The operation failed.',{
onopen:function(){alert('opened!');},
onclose:function(){alert('closed!');}, onok:function(){alert('ok');
$.weeboxs.close();} });
$.weeboxs.open('/modules/test/testsession.php', {contentType:'ajax'});
$.weeboxs.open('hello world');
$.weeboxs.open('The operation failed.',{type:'error'});
$.weeboxs.open('The operation failed.',{type:'wee'});
$.weeboxs.open('The operation failed.',{type:'success'});
$.weeboxs.open('The operation failed.',{type:'warning'});
$.weeboxs.open('Autoclosing in 5 seconds.', { timeout: 5 });


 

下面是weeboxs在網頁中的基本應用:
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
  2.                     "http://www.w3.org/TR/html4/loose.dtd">
  3. <html>
  4. <head>
  5. <title>Weebox教程一</title>
  6. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  7. <script type="text/javascript" src="../src/jquery.js"></script>
  8. <script type="text/javascript" src="../src/bgiframe.js"></script>
  9. <script type="text/javascript" src="../src/weebox.js"></script>
  10. <link type="text/css" rel="stylesheet" href="../src/weebox.css" />
  11. </head>
  12. <body>
  13.  
  14. <h1>直接顯示內容<input type="button" id="test1" value="演示[id=test1]"></h1>
  15. <pre>
  16. $("#test1").click(function(){
  17.         $.weeboxs.open('這是直接顯示的內容', {title: 'Hello World'});
  18. });
  19. </pre>
  20. <img target='_blank'>服務器上的內容', contentType:'ajax'});
  21. });
  22. </pre>
  23. <img alt="" src="demo6.jpg">
  24. <script type="text/javascript">
  25. $("#test6").click(function(){
  26.         $.weeboxs.open('ajax1.html', {title:'AJAX得到服務器上的內容', contentType:'ajax',width:400});
  27. });
  28. </script>
  29. <hr>
  30.  
  31. <h1>設置彈窗的寬度和高度<input type="button" id="test7" value="演示[id=test7]"></h1>
  32. <pre>
  33. $("#test7").click(function(){
  34.         $.weeboxs.open('ajax2.html', {title:'設置彈窗的寬度和高度', contentType:'ajax', width:600, height:300});
  35.         //dialog默認寬度為300,高度是自適應的
  36. });
  37. </pre>
  38. <img alt="" src="demo7.jpg">
  39. <script type="text/javascript">
  40. $("#test7").click(function(){
  41.         $.weeboxs.open('ajax2.html', {title:'設置彈窗的寬度和高度', contentType:'ajax', width:600, height:300});
  42. });
  43. </script>
  44. <hr>
  45.  
  46. <h1>不顯示背景遮照、不允許拖拽、自動關閉<input type="button" id="test8" value="演示[id=test8]"></h1>
  47. <pre>
  48. $("#test8").click(function(){
  49.         $.weeboxs.open('不顯示背景遮照、不允許拖拽、五秒鐘后自動關閉', {title:'測試<b>5</b>秒后自動關閉', modal:false, draggable:false, timeout:5, 
  50.                 onopen:function(box){
  51.                         var closetime = parseInt(box.dt.find('b').html(),10);
  52.                         var handle = setInterval(function(){
  53.                                 alert(1);
  54.                                 closetime--;
  55.                                 box.dt.find('b').html(closetime+'');
  56.                                 if (closetime<=0) clearInterval(handle);
  57.                         }, 1000);
  58.                 }
  59.         });
  60. });
  61. </pre>
  62. <img alt="" src="demo8.jpg">
  63. <script type="text/javascript">
  64. $("#test8").click(function(){
  65.         $.weeboxs.open('不顯示背景遮照、不允許拖拽、五秒鐘后自動關閉', {
  66.                 title:'測試<font color="red">5</font>秒后自動關閉', 
  67.                 modal:false,//默認為true 
  68.                 draggable:false,//默認為true
  69.                 timeout:5, //默認為0
  70.                 onopen:function(box){
  71.                         var closetime = parseInt(box.dt.find('font').html(),10);
  72.                         var handle = setInterval(function(){
  73.                                 closetime--;
  74.                                 box.dt.find('font').html(closetime);
  75.                                 if (closetime<=0) clearInterval(handle);
  76.                         }, 1000);
  77.                 }
  78.         });
  79. });
  80. </script>
  81. <hr>
  82.  
  83. <h1>彈窗打開后、及關閉后的光標定位<input type="button" id="test9" value="演示[id=test9]"></h1>
  84. <pre>
  85. $("#test9").click(function(){
  86.         $.weeboxs.open('ajax3.html', {title:'彈窗打開后、及關閉后的光標定位', contentType:'ajax', focus:'#focusele', blur:'.blurele'});
  87. });
  88. </pre>
  89. <img alt="" src="demo9.jpg">
  90. <script type="text/javascript">
  91. $("#test9").click(function(){
  92.         $.weeboxs.open('ajax3.html', {title:'彈窗打開后、及關閉后的光標定位', contentType:'ajax', focus:'#focusele', blur:'.blurele'});
  93. });
  94. </script>
  95.  
  96.  
  97. <input type="text" size="40" class="blurele" value="彈窗關閉后光標定位到這兒">
  98. <hr>
  99.  
  100. <h1>修改確定和取消的按鈕名字<input type="button" id="test10" value="演示[id=test10]"></h1>
  101. <pre>
  102. $("#test10").click(function(){
  103.         $.weeboxs.open('修改確定和取消的按鈕名字', {title:'修改按鈕名字', okBtnName:'保存', cancelBtnName:'放棄'});
  104. });
  105. </pre>
  106. <img alt="" src="demo10.jpg">
  107. <script type="text/javascript">
  108. $("#test10").click(function(){
  109.         $.weeboxs.open('修改確定和取消的按鈕名字', {title:'修改按鈕名字', okBtnName:'保存', cancelBtnName:'放棄'});
  110. });
  111. </script>
  112. <hr>
  113.  
  114. <h1>不顯示某個按鈕、按鈕欄<input type="button" id="test11" value="演示[id=test11]"></h1>
  115. <pre>
  116. $("#test11").click(function(){
  117.         $.weeboxs.open('不顯示標題和按鈕欄', {
  118.                 title:'測試',
  119.                 showButton:false,//不顯示按鈕欄
  120.                 showOk:false,//不顯示確定按鈕
  121.                 showCancel:false//不顯示取消按鈕               
  122.         });
  123. });
  124. </pre>
  125. <img alt="" src="demo11.jpg">
  126. <script type="text/javascript">
  127. $("#test11").click(function(){
  128.         $.weeboxs.open('不顯示標題和按鈕欄', {
  129.                 title:'測試',
  130.                 showButton:false,//不顯示按鈕欄
  131.                 showOk:false,//不顯示確定按鈕
  132.                 showCancel:false//不顯示取消按鈕               
  133.         });
  134. });
  135. </script>
  136. <hr>
  137.  
  138.  
  139.  
  140. <h1>使用IFRAME的方式為彈窗提供內容<input type="button" id="test12" value="演示[id=test12]"></h1>
  141. <pre>
  142. $("#test12").click(function(){
  143.         $.weeboxs.open('http://www.google.com', {title:'IFRAME得到服務器上的內容', contentType:'iframe',width:500,height:200});
  144. });
  145. </pre>
  146. <img alt="" src="demo12.jpg">
  147. <script type="text/javascript">
  148. var weeboxDialog;
  149. $("#test12").click(function(){
  150.         weeboxDialog=$.weeboxs.open('jQuery.weebox.iframedialog.html', {title:'IFRAME得到服務器上的內容', contentType:'iframe',width:500,height:200});   
  151. });
  152. function closeIframeDialog() {
  153.         //$.weeboxs.close();  此方法失效?
  154.         weeboxDialog.close();
  155. }
  156. </script>
  157. <hr>
  158. </body>
  159. </html>
復制代碼

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 淄博市| 罗源县| 珠海市| 禹城市| 安平县| 阿鲁科尔沁旗| 平远县| 辰溪县| 静宁县| 循化| 丰顺县| 河南省| 宿州市| 凤翔县| 仁化县| 开阳县| 抚宁县| 延吉市| 綦江县| 孟津县| 建始县| 马鞍山市| 文成县| 山西省| 白沙| 常州市| 舟山市| 剑川县| 成武县| 长沙市| 基隆市| 兴国县| 南充市| 鄂托克旗| 淅川县| 东乌珠穆沁旗| 吴旗县| 舞钢市| 宣化县| 临桂县| 毕节市|