zoukankan      html  css  js  c++  java
  • js动态生成div和事件

    <script language=javascript>
            var divId=1;
            //动态生成单纯的div
            function CreateOuterDiv()
            {
                var obj=document.createElement("div");
                obj.id="myDiv"+divId;
                divId++;
                obj.style.border="1px solid #000000";
                obj.style.height="30px";
                obj.style.width="200px";
                obj.style.filter="alpha(opacity=70)";           
                obj.style.margin="10px";    
                obj.style.cursor="hand";
                obj.algin="center";      
                //obj.innerHTML="<a href='#"+obj.id+"'>ssssssssss</a>";
                obj.innerText="sssssss";
               
                document.body.appendChild(obj);         
                document.getElementById(obj.id).onclick=function(){aa();};           
            }
            function aa()
            {
                CreateOuterDiv();//alert();
            }      
        </script>
  • 相关阅读:
    mybatis-cache model
    多线程开发(1)
    正则表达式(3) — 正则表达式库
    正则表达式(2) — 表达式规则
    我在迈瑞工作的两年总结
    正则表达式(1) — 常用的表达式
    C++系列(2) — 智能指针
    C++系列(1) — string
    路径去除前缀
    SIMD性能优化
  • 原文地址:https://www.cnblogs.com/see7di/p/2239847.html
Copyright © 2011-2022 走看看