Solved

ShowModalDialog

Posted on 2004-08-27
9
510 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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

I will show you how to create a ASP.NET Captcha control without using any HTTP HANDELRS or what so ever. you can easily plug it into your web pages. For Example a = 2 + 3 (where 2 and 3 are 2 random numbers) Session("Answer") = 5 then we…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

832 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