js的alert样式如何更改如背景颜色
2014-09-16 11:16
681 查看
代码如下:
window.alert = function(str)
{
var shield = document.createelement(div);
shield.id = shield;
shield.style.position = absolute;
shield.style.left = 0px;
shield.style.top = 0px;
shield.style.width = 100%;
shield.style.height = document.body.scrollheight+px;
//弹出对话框时地背景颜色
shield.style.background = #fff;
shield.style.textalign = center;
shield.style.zindex = 25;
//背景透明 ie有效
//shield.style.filter = alpha(opacity=0);
var alertfram = document.createelement(div);
alertfram.id=alertfram;
alertfram.style.position = absolute;
alertfram.style.left = 50%;
alertfram.style.top = 50%;
alertfram.style.marginleft = -225px;
alertfram.style.margintop = -75px;
alertfram.style.width = 450px;
alertfram.style.height = 150px;
alertfram.style.background = #ff0000;
alertfram.style.textalign = center;
alertfram.style.lineheight = 150px;
alertfram.style.zindex = 300;
strhtml = <ul style=\list-style:none;margin:0px;padding:0px;width:100%\>\n;
strhtml += <li
style=\background:#dd828d;text-align:left;padding-left:20px;font-size:14px;font-weight:bold;height:25px;line-height:25px;border:1px
solid #f9cade;\>[自定义提示]</li>\n;
strhtml += <li
style=\background:#fff;text-align:center;font-size:12px;height:120px;line-height:120px;border-left:1px
solid #f9cade;border-right:1px solid #f9cade;\>+str+</li>\n;
strhtml += <li
style=\background:#fdeef4;text-align:center;font-weight:bold;height:25px;line-height:25px;
border:1px solid #f9cade;\><input type=\button\ value=\确 定\
onclick=\dook()\ /></li>\n;
strhtml += </ul>\n;
alertfram.innerhtml = strhtml;
document.body.appendchild(alertfram);
document.body.appendchild(shield);
var ad = setinterval(doalpha(),5);
this.dook = function(){
alertfram.style.display = none;
shield.style.display = none;
}
alertfram.focus();
document.body.onselectstart = function(){return false;};
}
window.alert = function(str)
{
var shield = document.createelement(div);
shield.id = shield;
shield.style.position = absolute;
shield.style.left = 0px;
shield.style.top = 0px;
shield.style.width = 100%;
shield.style.height = document.body.scrollheight+px;
//弹出对话框时地背景颜色
shield.style.background = #fff;
shield.style.textalign = center;
shield.style.zindex = 25;
//背景透明 ie有效
//shield.style.filter = alpha(opacity=0);
var alertfram = document.createelement(div);
alertfram.id=alertfram;
alertfram.style.position = absolute;
alertfram.style.left = 50%;
alertfram.style.top = 50%;
alertfram.style.marginleft = -225px;
alertfram.style.margintop = -75px;
alertfram.style.width = 450px;
alertfram.style.height = 150px;
alertfram.style.background = #ff0000;
alertfram.style.textalign = center;
alertfram.style.lineheight = 150px;
alertfram.style.zindex = 300;
strhtml = <ul style=\list-style:none;margin:0px;padding:0px;width:100%\>\n;
strhtml += <li
style=\background:#dd828d;text-align:left;padding-left:20px;font-size:14px;font-weight:bold;height:25px;line-height:25px;border:1px
solid #f9cade;\>[自定义提示]</li>\n;
strhtml += <li
style=\background:#fff;text-align:center;font-size:12px;height:120px;line-height:120px;border-left:1px
solid #f9cade;border-right:1px solid #f9cade;\>+str+</li>\n;
strhtml += <li
style=\background:#fdeef4;text-align:center;font-weight:bold;height:25px;line-height:25px;
border:1px solid #f9cade;\><input type=\button\ value=\确 定\
onclick=\dook()\ /></li>\n;
strhtml += </ul>\n;
alertfram.innerhtml = strhtml;
document.body.appendchild(alertfram);
document.body.appendchild(shield);
var ad = setinterval(doalpha(),5);
this.dook = function(){
alertfram.style.display = none;
shield.style.display = none;
}
alertfram.focus();
document.body.onselectstart = function(){return false;};
}
相关文章推荐
- js的alert样式如何更改如背景颜色
- js的alert样式如何更改如背景颜色
- 如何更改js的alert样式
- IOS 如何更改导航栏样式及状态栏字体颜色(导航栏背景、前景、标题及返回字体颜色)
- 如何更改cad块编辑的背景颜色
- Flex Gumbo中如何通过contentBackgroundColor样式,设置TextInput内文本背景颜色
- 如何更改ActionMode的菜单条的背景颜色
- notepad++如何更改编辑界面前背景颜色?
- 如何利用PS 更改图像背景颜色
- Flex中如何通过backgroundImage, backgroundColor和backgroundAlpha样式,设置VBox的背景图片和背景颜色以及改变透明度
- 如何更改iOS上的UISearchBar组件的内部背景颜色
- android:更改PagerTabStrip背景颜色,标题字体样式、颜色和图标,以及指示条的颜色
- UGUI 如何代码更改image的背景图片、颜色以及材质
- Flex Gumbo中如何通过baseColor样式,设置FxHScrollBar背景颜色
- 如何更改Eclipse的字体和背景颜色
- 在几何画板中如何更改背景颜色
- 如何更改piechart的datatip的背景颜色
- 如何用matlab来更改登记照的背景颜色?
- Mac版本idea15如何更改编辑器的背景颜色为黑色
- 85.如何更改iOS上的UISearchBar组件的内部背景UITextField颜色 修改UISearchBar删除按钮ClearButton