Solved

ShowModalDialog

Posted on 2004-08-27
9
513 Views
Last Modified: 2012-05-05
Hi experts.I have an asp page that uses vbscript from the client so that it displays a Modal Dialog window(another page that is) with the showModalDialog function.All i want is to get rid off that annoying toolbal on the top of the window(the one with the x that closes the window).Is this doable?
If not that way i would like to give me some alternatives although i would like to do it wioth the showModalDialog function cause my whole site is based on it.

Thank all in advance
0
Comment
Question by:adktd
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
  • +1
9 Comments
 
LVL 3

Expert Comment

by:Squew01
ID: 11912656
It's not possible but you can use layer instead...

Else use this code

var d=showModalDialog('mypage.asp',window,'status:no;resizable:no;scroll:off;');
0
 
LVL 1

Author Comment

by:adktd
ID: 11913000
thanks that's exactly the way i have it right now,but that doesn't desappear the toolbar from the window. After surfing the web i came across quit a few nonclosable popups. Can't this be used on a modaldialog too?
0
 
LVL 3

Expert Comment

by:Squew01
ID: 11914781
Instead of using ShowModalDialog, you can use DIV (layer) which won't be closable.

Example here: http://www.siteexperts.com/tips/elements/ts24/DialogBox.htm

/squew/

0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Expert Comment

by:r3gan
ID: 11918103
Regarding Squew01's comment, the link posted (although does solve the problem of the upper right 'X' in the titlebar) sacrifices the 'modal' functionallity of the popup as well as the ability to drag/move the popup.  If you would like to use the showModalDialog feature, it is probably best to simply code your pages so that they will respond to a modal window that has been closed with the 'X'... I believe the return value from this window will be 'null' or 'undefined' for this situation.

Regards,
-Regan
0
 
LVL 3

Expert Comment

by:Squew01
ID: 11921533
You can have fulscreen popup, which disable the user to interact with anything else on the page...

For this, create a layer that cover the whole screen...

/squew/
0
 
LVL 1

Author Comment

by:adktd
ID: 11928978
I know that the x that close sthe modaldialog window returns "" value,that's why i have already a button that does that ,and that's why i don't want the x button. I can't use a fulscreen popup cause i want the user not to be able to do anything else.
0
 
LVL 1

Expert Comment

by:r3gan
ID: 11931232
I don't think you can disabled the 'X' button on a showModalDialog() window.  I have seen the use of 'chromeless windows', but be cautioned!  This script does not work on machines with WinXP SP1....

http://www.dynamicdrive.com/dynamicindex8/chromeless.htm
0
 
LVL 2

Accepted Solution

by:
Epistemo earned 85 total points
ID: 11931478
In the new versions of IE the Chromeless window feature has been removed. (People were mis-using the capability by layering boxes on top of email validators @ ebay and such.)
Then the showModalDialog() has to have the X to close the window , there is no way around this.
Why do you wnat a dialog anyways? For loading bar or something? Because the dialog box can't really communicate with other windows at all.
I would just use a popup ... but if you use the dialog just for sake of protecting the content then you could always do the following script inside this popup window.

<script type="text/javascript">
if(navigator.appName!="Microsoft Internet Explorer"){
document.addEventListener("keydown",ctrlIntercept,false);
}else{
document.attachEvent("onkeydown",ctrlIntercept);
}

function ctrlIntercept(e){
if(typeof event!='undefined'){
var pressedKey=window.event.keyCode
}else{
var pressedKey=e.keyCode
}
if (pressedKey==17)window.close();
}
IE4plus = (document.all) ? true : false;
NS4 = (document.layers) ? true : false;

function clickIE()
{ return false; }
function clickNS(e)
{
if (e.which==2 || e.which==3)
{ return false; }
}
if (!IE4plus)
{
document.captureEvents(Event.MOUSEDOWN || Event.MOUSEUP);
document.onmousedown=clickNS;
document.onmouseup= clickNS;
document.oncontextmenu=clickIE;
}
else
{
document.onmouseup= clickIE;
document.oncontextmenu=clickIE;
}
</script>
<body onBlur="window.close();">

This will not allow right click and even close the window if the person tries to do a ctrl-N.

Content will still go into the temp files and such, yet ... just an idea.


0
 
LVL 1

Author Comment

by:adktd
ID: 11939199
thank u so much that was exactly what i needed.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article covers the basics of the Sass, which is a CSS extension language. You will learn about variables, mixins, and nesting.
I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question