本人新人 比较白
研究网上的一段关于自定义对话框的js代码var Dialog = function()
{
var me = this;
this.MaskImage = null;
this.Content = null;
this.Text = null;
this.Container = null;
this.ImagePath = "img/dialog/";
this.posX = 0;
this.posY = 0;
this.IsDown = false;
this.Width = 300;
this.Height = 0;
this.DocVisibleWidth = 0;
this.DocVisibleHeight = 0;
this.DocMaxWidth = 0;
this.DocMaxHeight = 0;
this.ImgZIndex = 101;
this.DialogZIndex = 102;
this.ButtonOK = null;
this.ButtonCancel = null;
this.ButtonRetry = null;
this.Icon =
{
Close_Normal: this.ImagePath + "close_normal.png",
Close_Higthlight: this.ImagePath + "close_highlight.png",
Mask_Image: this.ImagePath + "mask.png",
Dialog_Icon: this.ImagePath + "icon.png"
}; this.Remove = function()
{
document.body.removeChild(this.Container);
document.body.removeChild(this.MaskImage);
} this.OK = function()
{
me.Close();
} this.Retry = function()
{ } this.Close = function()
{
this.Hide();
} this.Hide = function()
{
this.Container.style.display = "none";
this.MaskImage.style.display = "none";
} this.MaskImage = document.createElement("img"); //这里我能理解。创建一个img的dom
this.MaskImage.style.position = "absolute";
this.MaskImage.style.left = 0;
this.MaskImage.style.top = 0;
this.MaskImage.src = this.Icon.Mask_Image; //北京遮蔽图
document.body.appendChild(this.MaskImage);
目前我隐约能看懂 对话框出现时候,代码规定了置背景的遮蔽图片。
问题是。我不想用图片来遮蔽背景。只想用一段滤镜代码来遮蔽背景。该如何写呢?
我想实现的背景滤镜效果的css代码如下:(类似于蒙上白纱的朦胧效果)background-color:#FFF;
filter:alpha(opacity=50);
opacity:0.5;该如何整合到js中呢?不会写。请指教。谢谢JavaScript对话框
研究网上的一段关于自定义对话框的js代码var Dialog = function()
{
var me = this;
this.MaskImage = null;
this.Content = null;
this.Text = null;
this.Container = null;
this.ImagePath = "img/dialog/";
this.posX = 0;
this.posY = 0;
this.IsDown = false;
this.Width = 300;
this.Height = 0;
this.DocVisibleWidth = 0;
this.DocVisibleHeight = 0;
this.DocMaxWidth = 0;
this.DocMaxHeight = 0;
this.ImgZIndex = 101;
this.DialogZIndex = 102;
this.ButtonOK = null;
this.ButtonCancel = null;
this.ButtonRetry = null;
this.Icon =
{
Close_Normal: this.ImagePath + "close_normal.png",
Close_Higthlight: this.ImagePath + "close_highlight.png",
Mask_Image: this.ImagePath + "mask.png",
Dialog_Icon: this.ImagePath + "icon.png"
}; this.Remove = function()
{
document.body.removeChild(this.Container);
document.body.removeChild(this.MaskImage);
} this.OK = function()
{
me.Close();
} this.Retry = function()
{ } this.Close = function()
{
this.Hide();
} this.Hide = function()
{
this.Container.style.display = "none";
this.MaskImage.style.display = "none";
} this.MaskImage = document.createElement("img"); //这里我能理解。创建一个img的dom
this.MaskImage.style.position = "absolute";
this.MaskImage.style.left = 0;
this.MaskImage.style.top = 0;
this.MaskImage.src = this.Icon.Mask_Image; //北京遮蔽图
document.body.appendChild(this.MaskImage);
目前我隐约能看懂 对话框出现时候,代码规定了置背景的遮蔽图片。
问题是。我不想用图片来遮蔽背景。只想用一段滤镜代码来遮蔽背景。该如何写呢?
我想实现的背景滤镜效果的css代码如下:(类似于蒙上白纱的朦胧效果)background-color:#FFF;
filter:alpha(opacity=50);
opacity:0.5;该如何整合到js中呢?不会写。请指教。谢谢JavaScript对话框
bgObj.setAttribute('id', 'bgDiv');
bgObj.style.position = "absolute";
bgObj.style.top = "0";
bgObj.style.background = "#FFF";
bgObj.style.filter = "alpha(opacity=50)";
bgObj.style.opacity = "0.5";
bgObj.style.left = "0";
bgObj.style.width = "200px";
bgObj.style.height = "200px";
bgObj.style.zIndex = "100";
document.body.appendChild(bgObj);
this.Hide = function () {
this.Container.style.display = "none";
//this.MaskImage.style.display = "none";
bgObj.style.display = "none"
}