jquery模型对话框。

编程入门 行业动态 更新时间:2024-10-11 01:10:45
本文介绍了jquery模型对话框。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

Here is my full Html Page <html> <head> <title>Start Page</title> <script src="ajax.googleapis/ajax/libs/jquery/1.4.2/jquery.min.js"></script> <script src="ajax.googleapis/ajax/libs/jqueryui/1.8.1/jquery-ui.min.js"></script> <link rel="stylesheet" href="ajax.googleapis/ajax/libs/jqueryui/1.7.2/themes/redmond/jquery-ui.css" type="text/css" /> <script type="text/javascript"> var $dialog = null; jQuery.showModalDialog = function(options) { var defaultOptns = { url: null, dialogArguments: null, height: 'auto', width: 'auto', position: 'center', resizable: true, scrollable: true, onClose: function() { }, returnValue: null, doPostBackAfterCloseCallback: false, postBackElementId: null }; var fns = { close: function() { opts.returnValue = $dialog.returnValue; $dialog = null; opts.onClose(); if (opts.doPostBackAfterCloseCallback) { postBackForm(opts.postBackElementId); } }, adjustWidth: function() { $frame.css("width", "100%"); } }; var opts = $.extend({}, defaultOptns, options); var $frame = $('<iframe id="iframeDialog" />'); if (opts.scrollable) $frame.css('overflow', 'auto'); $frame.css({ 'padding': 0, 'margin': 0, 'padding-bottom': 10 }); var $dialogWindow = $frame.dialog({ autoOpen: true, modal: true, width: opts.width, height: opts.height, resizable: opts.resizable, position: opts.position, overlay: { opacity: 0.5, background: "black" }, close: fns.close, resizeStop: fns.adjustWidth }); $frame.attr('src', opts.url); fns.adjustWidth(); $frame.load(function() { if ($dialogWindow) { var maxTitleLength = 50; var title = $(this).contents().find("title").html(); if (title.length > maxTitleLength) { title = title.substring(0, maxTitleLength) + '...'; } $dialogWindow.dialog('option', 'title', title); } }); $dialog = new Object(); $dialog.dialogArguments = opts.dialogArguments; $dialog.dialogWindow = $dialogWindow; $dialog.returnValue = null; } function postBackForm(targetElementId) { var theform; theform = document.forms[0]; theform.__EVENTTARGET.value = targetElementId; theform.__EVENTARGUMENT.value = ""; theform.submit(); } // function to open THE POPUP var inc=1; function test() { while(inc <=2) { debugger; if(inc==1) { var url = 'TestPopup1.html'; $.showModalDialog({ url: url, dialogArguments: 'First Dialog', height: 300, width: 400, scrollable: false, onClose: function(){ var returnedValue = this.returnValue; } }); } if (inc == 2) { var url = 'TestPopup2.html'; $.showModalDialog({ url: url, dialogArguments: 'Second Dialog', height: 300, width: 400, scrollable: false, onClose: function () { var returnedValue = this.returnValue; } }); } inc=inc+1; } } </script> </head> <body> <input type="button" onclick="test();" value="Open Popup" /> </body> </html>

我的问题是当我点击打开弹出按钮时第一个对话框被打开第二个对话框没有打开请帮我打开两个弹出窗口。 ie 当值为变量inc == 1然后第一个弹出窗口应该打开 和变量inc值== 2然后第二个弹出窗口uld open

My problem is when I click Open Popup Button the First Dialog gets open and second dialog does not open please help me to open both popup. i.e. when value of variable inc == 1 then First popup should open and value of variable inc == 2 then Second popup should open

推荐答案

dialog = null; jQuery.showModalDialog = function(options){ var defaultOptns = { url:null, dialogArguments:null, height:'auto', width:'auto', position:'center', resizable:true, scrollable:true, onClose :function(){}, returnValue:null, doPostBackAfterCloseCallback:false, postBackElementId:null }; var fns = { close:function(){ opts.returnValue = dialog = null; jQuery.showModalDialog = function(options) { var defaultOptns = { url: null, dialogArguments: null, height: 'auto', width: 'auto', position: 'center', resizable: true, scrollable: true, onClose: function() { }, returnValue: null, doPostBackAfterCloseCallback: false, postBackElementId: null }; var fns = { close: function() { opts.returnValue =

dialog.returnValue; dialog.returnValue;

dialog = null; opts.onClose(); if(opts.doPostBackAfterCloseCallback){ postBackForm(opts.postBackElementId); } }, adjustWidth:function(){ dialog = null; opts.onClose(); if (opts.doPostBackAfterCloseCallback) { postBackForm(opts.postBackElementId); } }, adjustWidth: function() {

更多推荐

jquery模型对话框。

本文发布于:2023-11-28 03:50:27,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1640842.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:对话框   模型   jquery

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!