How to Disable a web Page along with displaying a popup to perform

S

smartwebcoder

Hi I have again tried some common functionality that we all need some
times.
Below is the Javascript Function which You can call on any event to
Disable your webpage.

// Function made to disable Page
/**********************************************************/
var divtemp;
function DisablePage()
{
divtemp = document.createElement("div");
divtemp.style.top = 0;
divtemp.style.left = 0;
//divtemp.style.height = screen.height;
//divtemp.style.width = screen.width;

//divtemp.style.height = document.forms[0].offsetHeight;
//divtemp.style.width = document.forms[0].offsetWidth;

divtemp.style.height = window.document.body.clientHeight;
divtemp.style.width = window.document.body.clientWidth;


divtemp.style.position = "absolute";
divtemp.id = "divIdName";
divtemp.className = 'disablePage';
divtemp.style.zIndex = 998;
var arrForm = document.getElementsByTagName("Form");
arrForm[0].appendChild(divtemp)
//
document.getElementById("divtemp").appendChild("floatlayer");

document.getElementById("dvDialog").style.zIndex = 999;
}

/**********************************************************/

Below is the css that will you the feel that yes Page is got
Disabled. :)

..disablePage
{
position: absolute;
z-index: 500;
top: 0px;
left: 0px;
height: 80%;
width: 80%;
filter: alpha(opacity=90);

background-color: Transparent;
background-color: gold;
background-image: none;
background-repeat: repeat;
display: block;
}

/**********************************************************/

Below code shows how to call DisablePage() function. :)

<input type="button" value="Disable Page" onClick="DisablePage()" />



Please feel free to comment on my Little Javascript. :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,190
Members
46,740
Latest member
AdolphBig6

Latest Threads

Top