Solved

ShowModalDialog

Posted on 2004-08-27
9
505 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
  • 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
 
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
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This article covers the basics of the Sass, which is a CSS extension language. You will learn about variables, mixins, and nesting.
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

758 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now