Click here to Skip to main content
14,176,928 members
Click here to Skip to main content
Add your own
alternative version

Stats

37.5K views
341 downloads
18 bookmarked
Posted 24 Apr 2009
Licenced CPOL

Disable Parent Window

, 24 Apr 2009
Rate this:
Please Sign up or sign in to vote.
To give disabled effect to parent window

Introduction

This article discusses how to give a disabled effect to the parent window on open of an alert or confirm dialog.

Using the Code

To keep it simple, in DisabledEffect project I have used simple HTML and JavaScript for changing the style of the div. This demo HTML clearly shows how div style changes can give a better feel to your user.

The screen shot given below shows the parent window in disabled mode.

screenshot.gif

The full source code is given below. The same code is included in the *.zip file also.

<html>
<head>
<title>Disabled Effect</title>
<script language="javascript">

function DisabledEffect()
{
    document.getElementById ('MainDiv').style.display='';
    document.getElementById ('MainDiv').style.visibility='visible';
    document.getElementById ('MainDiv').style.position='absolute';

    document.getElementById ('MainDiv').style.top='0px';
    document.getElementById ('MainDiv').style.left='0px';
    document.getElementById ('MainDiv').style.width= '100%';
    document.getElementById ('MainDiv').style.height= '100%';

    document.getElementById('MainDiv').style.backgroundColor = "Gray";
    document.getElementById('MainDiv').style.filter = "alpha(opacity=60)";
    document.getElementById('MainDiv').style.opacity = "0.6";

    alert("Parent window in disabled effect!!!");

    document.getElementById ('MainDiv').style.display='none';
    document.getElementById ('MainDiv').style.visibility='hidden';

    document.getElementById ('MainDiv').style.top='0px';
    document.getElementById ('MainDiv').style.left='0px';
    document.getElementById ('MainDiv').style.width= '0px';
    document.getElementById ('MainDiv').style.height= '0px';
}

</script>
</head>
<body>
<form id="frmMain" runat="server">
<div id="MainDiv"></div>

This is just some text <br /><br />

Test Textbox : <input type=text /> <br /><br /><br />

<input type=button value="Click Me" onclick="DisabledEffect()" />
</form>
</body>
</html>

History

  • 24th April, 2009: Initial post

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

azamqadri
India India
No Biography provided

You may also be interested in...

Comments and Discussions

 
Questioncode not properly working Pin
Archana9997-Mar-12 0:09
memberArchana9997-Mar-12 0:09 
Generalheight= '100%' not valid Pin
PsyAfter3-May-09 5:28
memberPsyAfter3-May-09 5:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web02 | 2.8.190526.1 | Last Updated 24 Apr 2009
Article Copyright 2009 by azamqadri
Everything else Copyright © CodeProject, 1999-2019
Layout: fixed | fluid