WebFX WebBoard
Message Thread:
View All Messages
Back to WebFX
 Modal Dialogs with Mozilla, Jose Luis Martinez, July 6, 2004
     Re:Modal Dialogs with Mozilla, Idris, July 6, 2004
         Re:Modal Dialogs with Mozilla, Jason, July 7, 2004

Subject: Re:Modal Dialogs with Mozilla From: Jason Date: July 7, 2004

heres the code i use below, you put this in the parent window as well as the dialouge window

then you do something like

var w = new modalWindow(500,300)
w.onclose = function( returnValue ){
       alert( returnValue )
}
var dialogArguments = "I was Here"
w.open( "mydiolugebox.html", dialogArguments )

Dialouge then works in Moz like IE with window.dialogArguments and window.returnValue. 

  function modalWindow(width,height){ var id = modalWindow.stack.push(this) - 1 var win var args this._onclose = function(value){ window.onfocus = function(){ } modalWindow.current = false this.onclose(value) } this.onclose = function(value){} this.getDialogArguments = function(){ return args } this.open = function(url,_args,override){ args = _args if(!window.showModalDialog || override){ var LeftPosition=(screen.width-width)/2 var TopPosition=(screen.height-height)/2 modalWindow.current = win = window.open(url,'ModalWindow_'+id,'top='+TopPosition+',left='+LeftPosition+',width='+(width || 300)+',height='+ (height||180) +',modal,dialog') window.onfocus = function(){ modalWindow.current.focus() } }else{ var rv = window.showModalDialog( url , args , "dialogWidth:"+(width||300)+"px; dialogHeight: "+(height||180)+"px; status: no; help: no")   this.onclose( rv ) } } } modalWindow.stack = [] modalWindow.current = false // Set up modal window features for Moz if(window.opener && window.name.split('_')[0] == 'ModalWindow'){ if(!window.returnValue) window.returnValue = false; var _creator = window.opener.modalWindow.stack[ window.name.split('_')[1] ] dialogArguments = _creator.getDialogArguments() window.onunload = function(){ _creator._onclose(returnValue) } window.onblur = function(){ window.focus() } }    



Reply
Name: 
Email: 
Subject: 

Enter your reply to this message below. HTML tags are not supported but words that start with http://, ftp:// or mailto: are converted to links.


View All Messages
Back to WebFX