• javascript操作css实现弹出对话框


    尝试运行代码效果:

     ------------------------------------------效果-----------------------------------------------

     

     -----------------------------------------代码-----------------------------------------------------------------------------------

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
    <html xmlns="">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>无标题文档</title>
    <script type="text/javascript">
    function ss(){
    var div=document.createElement("div");
    var textarea=document.createElement("textarea");

    var button=document.createElement("input");
    button.type='button';
    button.value='OK';
    button.onclick=function(){
    document.getElementById("show").value=textarea.value;
    document.body.removeChild(button);
    document.body.removeChild(textarea);
    document.body.removeChild(div);
    }
    setStyle(div,{
    'position':'absolute',
    'left':0,
    'top':0,
    'bottom':0,
    'right':0,
    'backgroundColor':'black',
    'opacity':.5,
    'filter':'alpha(opacity=50)'
    });
    setStyle(button,{
    'position':'absolute',
    'left':'250px',
    'top':'160px'
    })
    setStyle(textarea,{
    'position':'absolute',
    'left':'100px',
    'top':'100px'
    })
    document.body.appendChild(div);
    document.body.appendChild(button);
    document.body.appendChild(textarea);


    }
    function setStyle(dom,style){
    for(var i in style){
    if(style.hasOwnProperty(i)){
    dom.style[i]=style[i];
    }
    }
    }
    </script>
    </head>

    <body>
    <input type="text" id="show" />
    <input type="button" value="输入" onclick="ss()">
    </body>
    </html>

  • 相关阅读:
    Linux下并发网络设计之I/O复用
    嵌入式系统 Boot Loader
    linux下curl编程
    c语言中-----分配内存函数
    关于typedef之四种用途 和 两个陷进
    Libcurl安装及编译
    linux线程之pthread_join和pthread_detach
    Linux系统源码安装过程中的prefix选项
    linux之线程之互斥
    linux之线程
  • 原文地址:https://www.cnblogs.com/jiangwenli/p/4870391.html
Copyright © 2020-2023  润新知