Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to use ShowModalDialog() inside this function

Status
Not open for further replies.

bnymk

Programmer
Joined
Feb 7, 2003
Messages
296
Location
US
Hello All;

I'm trying to use the showModalDialog() feature inside my code (below) but am not being successful. Could someone point me out the the error that I'm making????

Thanks.

function firstNonCounterProcessingWindow(){
if(win&& win.open && !win.closed) win.close();
win = window.showModalDialog("", "win", "dialogWidth:450;dialogHeight:110;dialogLeft:275;dialogTop:275");
with(win.document){
write("<HTML><HEAD><TITLE>Processing Request....</TITLE></HEAD><BODY bgcolor='#fff8dc' onblur='this.focus();'> " +
"<CENTER><h3>Please wait while your request is being processed.</h3> " +
"</CENTER></BODY></HTML>");
close();//close the output stream after finished writing content to the window
}
}

function firstCounterProcessingWindow(counter, message){
win = window.showModalDialog("", "win", "dialogWidth:450;dialogHeight:110;dialogLeft:275;dialogTop:275");
with(win.document) {
open("text/html", "Replace");//replace the text of the existing processing window with new contents
write("<HTML><HEAD><TITLE>Processing Request.....</TITLE></HEAD><BODY bgcolor='#fff8dc' onblur='this.focus();'><CENTER> " +
"<h3>Please wait while your request is being processed.</h3> " +
"<table><tr><td style='font-family:arial; size:8pt'><span id='textCount' ></span>Request status:" + counter + "% completed.</td></tr></table> " +
"<table><tr><td style='font-family:arial; size:8pt'><span id='textMessage'></span>" + message + "</td></tr></table> " +
"</center></body></html>");
close();//close the output stream after finished writing content to the window
}
}


"Behind every great fortune there lies a great crime", Honore De Balzac
 
i'm not sure you can write to a modal dialog...it's meant to be passed the url of a document to display.

furthermore, showModalDialog() does not return a reference to the dialog window, but rather returns a value from it.

=========================================================
-jeff
try { succeed(); } catch(E) { tryAgain(); } finally { rtfm(); }
 
Thanks for responding.....I guess I can't use the showModalDialog() in this case.

"Behind every great fortune there lies a great crime", Honore De Balzac
 
If you use the following function:
Code:
function showCustomModalDialog(msg,opts)
  return window.showModalDialog("customModal.html",msg,opts);
}
and create a page called customModal.html with the following content:
Code:
<script>
document.write(window.dialogArguments);
document.close();
</script>
then you should be able to do what you want using this:
Code:
var msg="<HTML><HEAD><TITLE>Processing Request....</TITLE></HEAD><BODY bgcolor='#fff8dc'> " +
            "<CENTER><h3>Please wait while your request is being processed.</h3> " +
            "</CENTER></BODY></HTML>";
var opts="dialogWidth:450px;dialogHeight:110px;dialogLeft:275px;dialogTop:275px;resizeable:yes;status:no;";
var returnValue=showCustomModalDialog(msg,opts);

Adam
while(ignorance){perpetuate(violence,fear,hatred);life=life-1};
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top