• js的alert样式如何更改如背景颜色


    代码如下:

    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;100%> ;
    strhtml += <li style=ackground:#dd828d;text-align:left;padding-left:20px;font-size:14px;font-weight:bold;height:25px;line-height:25px;border:1px solid #f9cade;>[自定义提示]</li> ;
    strhtml += <li style=ackground:#fff;text-align:center;font-size:12px;height:120px;line-height:120px;border-left:1px solid #f9cade;border-right:1px solid #f9cade;>+str+</li> ;
    strhtml += <li style=ackground:#fdeef4;text-align:center;font-weight:bold;height:25px;line-height:25px; border:1px solid #f9cade;><input type=utton value=确 定 onclick=dook() /></li> ;
    strhtml += </ul> ;
    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;};
    }
  • 相关阅读:
    python学习之模块(pip),列表生成式,模块操作mysql,excel
    python学习之非空即为真,函数,集合,解包与打包
    配置虚拟机和网络配置
    python学习之文件读写,序列化(json,pickle,shelve)
    python学习之列表,元祖,字典
    盒子内部文字超出不换行
    织梦dedecms文章发布日期时间调用标签大全
    贝塞尔曲线值
    CSS解决border影响元素宽高的问题(box-sizing属性)
    pc建站自适应
  • 原文地址:https://www.cnblogs.com/yongwuqing/p/3974491.html
Copyright © 2020-2023  润新知