zoukankan      html  css  js  c++  java
  • JS tips

    ===============add element=================

    function AddControl(objId)
    {
       var container  = document.getElementById(objId);
       var fIndex=1;
      
       for(var i=0; i<container.childNodes.length; i++)
       {
            if(typeof(container.childNodes[i].id)=="string" && container.childNodes[i].id.substring(0,4) == "file")
              fIndex++;
       }
      
       var newFile = document.createElement("input");
       newFile.setAttribute("type","file");
       newFile.setAttribute("id","file"+fIndex);
       newFile.setAttribute("name","file" + fIndex);
       container.appendChild(newFile);
      
       var newBR = document.createElement("br");
       container.appendChild(newBR);   
    }

    --window close event---

    function DetectBrowserExit()
    {
       alert('Execute task which do you want before exit');
    }

    window.onbeforeunload = function(){ DetectBrowserExit(); }

  • 相关阅读:
    设置eclipse编码
    前端基础知识
    微信小程序
    jQuery下拉框
    Vue-cli的安装
    vue的数据交互形式
    node安装和小测试
    shui
    JQ-滚动条下拉无限的加载数据
    HTML-video全屏
  • 原文地址:https://www.cnblogs.com/yang_sy/p/1628813.html
Copyright © 2011-2022 走看看