Click here to Skip to main content
15,915,319 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
MSIL
<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
    <title>Insert title here</title>
 <script type="text/javascript">
   window.size = function()
{
var w = 0;
var h = 0;
//IE
if(!window.innerWidth)
{
//strict mode
if(!(document.documentElement.clientWidth == 0))
{
w = document.documentElement.clientWidth;
h = document.documentElement.clientHeight;
}
//quirks mode
else
{
w = document.body.clientWidth;
h = document.body.clientHeight;
}
}
//w3c
else
{
w = window.innerWidth;
h = window.innerHeight;
}
return {width:w,height:h};
}
window.size = function()
{
var w = 0;
var h = 0;
//IE
if(!window.innerWidth)
{
//strict mode
if(!(document.documentElement.clientWidth == 0))
{
w = document.documentElement.clientWidth;
h = document.documentElement.clientHeight;
}
//quirks mode
else
{
w = document.body.clientWidth;
h = document.body.clientHeight;
}
}
//w3c
else
{
w = window.innerWidth;
h = window.innerHeight;
}
return {width:w,height:h};
}
window.center = function()
{
var hWnd = (arguments[0] != null) ? arguments[0] : {width:0,height:0};
var _x = 0;
var _y = 0;
var offsetX = 0;
var offsetY = 0;
//IE
if(!window.pageYOffset)
{
//strict mode
if(!(document.documentElement.scrollTop == 0))
{
offsetY = document.documentElement.scrollTop;
offsetX = document.documentElement.scrollLeft;
}
//quirks mode
else
{
offsetY = document.body.scrollTop;
offsetX = document.body.scrollLeft;
}
}
//w3c
else
{
offsetX = window.pageXOffset;
offsetY = window.pageYOffset;
}
_x = ((this.size().width-hWnd.width)/2)+offsetX;
_y = ((this.size().height-hWnd.height)/2)+offsetY;
return{x:_x,y:_y};
}
var bgObj=document.createElement("ss");
 function showCenter(point)
{
debugger;
var msgw,msgh,bordercolor;
   msgw=400;//Width
   msgh=238;//Height
   titleheight=25; //title Height
   bordercolor="#336699";//boder color
   titlecolor="#99CCFF";//title color
   var sWidth,sHeight;
   sWidth=document.body.offsetWidth;
   sHeight=screen.height;
  // var bgObj=document.createElement("ss");
   bgObj.setAttribute('id','bgDiv');
   bgObj.style.position="fixed";
    bgObj.style.top="0";
   bgObj.style.background="#777";
  bgObj.style.filter="alpha(opacity=50);zoom:1;"
   bgObj.style.opacity="0.5";
   bgObj.style.left="0";
   bgObj.style.width=sWidth + "px";
   bgObj.style.height=sHeight + "px";
   bgObj.style.zIndex = "10000";
   document.body.appendChild(bgObj);
   var msgObj=document.createElement("light");
  // msgObj.setAttribute("id","msgDiv");
   //document.getElementById('light').style.display='block';
  msgObj.setAttribute("align","center");
   msgObj.style.background="white";
   msgObj.style.border="1px solid " + bordercolor;
   msgObj.style.position = "absolute";
//   msgObj.style.top = point.y + "px";
 //  msgObj.style.left = point.x + "px";
   msgObj.style.font="12px/1.6em Verdana, Geneva, Arial, Helvetica, sans-serif";
   msgObj.style.marginLeft = "-225px" ;
  msgObj.filter = "alpha(opacity=0.5)";
   msgObj.style.width = msgw + "px";
   msgObj.style.height =msgh + "px";
   msgObj.style.textAlign = "center";
   msgObj.style.lineHeight ="25px";
   msgObj.style.zIndex = "10001";
// document.body.removeChild(msgObj);
  document.body.appendChild(bgObj);
   document.body.appendChild(msgObj);

}
 </script>
</head>
<body>
    <div runat="server">
      <a href = "javascript:void(0)" class="sublink"  onclick ="showCenter()">sss</a>
    </div>
</body>
</html>
Posted
Comments
[no name] 26-Jul-11 9:47am    
Show only the relevant code, people don't have time to read pages of code.

Try this
JavaScript
bgObj.style.opacity=0.5;
(without quotes)
 
Share this answer
 
Comments
Manas Bhardwaj 26-Jul-11 10:57am    
+5
As Shameel suggested, it would work but (stupid) IE does not recognise the CSS standards for opacity. Do a check for the browser, and for IE use this:

bgObj.style.filter = 'alpha(opacity=' + '60' + ')';
 
Share this answer
 
v2

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900