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>
  • 相关阅读:
    SQL 联合语句
    Strust2MVC
    struts2执行流程
    struts2的验证框架
    poj 1201 Intervals
    FZOJ Problem 2219 StarCraft
    poj 3470 Walls
    hdu 6021 MG loves string
    FZOJ Problem 2150 Fire Game
    FZOJ Problem 2148 Moon Game
  • 原文地址:https://www.cnblogs.com/see7di/p/2239847.html
Copyright © 2011-2022 走看看