zoukankan      html  css  js  c++  java
  • JQuery与JS 遍历和操作 父页面控件的比较

    var lableText = "<label class="mustFillcolor">*</label>";//*号控件
         
         //-----query mothed 遍历和删除父页面控件速度慢  

      //执行较慢代码 2秒
         $("[id='whir$gyspdsqb_ejtjfl']", window.opener.document).remove();

      //执行较慢代码 2秒      

         var ejtjDiv = $("[id='whir$gyspdsqb-whir$gyspdsqb_ejtjfl']", window.opener.document);
         var ejtjAjax = $.trim(com_ajax_ReqDo("/defaultroot/dlzg/gys/ajax_gys.jsp?tag=ejfltj&ejStr="+yjstrs[0])+'');
         var ejtjDivHtml = ejtjDiv.html();
         ejtjDiv.html(ejtjDivHtml.replace("*","")+ejtjAjax+lableText);
         
         //-----js mothed
         opener.document.getElementById("whir$gyspdsqb_ejtjfl").removeNode(true);
         var ejtjDiv = opener.document.getElementById("whir$gyspdsqb-whir$gyspdsqb_ejtjfl");
         var ejtjAjax = $.trim(com_ajax_ReqDo("/defaultroot/dlzg/gys/ajax_gys.jsp?tag=ejfltj&ejStr="+yjstrs[0])+'');
         var ejtjDivHtml = ejtjDiv.innerHTML;
         ejtjDiv.innerHTML = ejtjDivHtml.replace("*","")+ejtjAjax+lableText;
         opener.document.getElementById("whir$gyspdsqb_ejtjfl").value = $.trim(q_ejVal);

    两种不同的写法,效率差别太大,第一种jquery的写法执行速度大概3-4秒,第二种写法执行速度转瞬间。

    拿出来共享下。

    求原因......

  • 相关阅读:
    大话设计模式——UML图
    IdentityServer3零星笔记
    Angular路由
    基于jquery的静态页面翻页
    00_python安装与配置(mac)
    OracleParameter.UdtTypeName的值必须是全大写!
    VS2012调用64位IIS Express
    MVC中使用Ueditor
    优秀博客站点
    jqGrid中的formatter
  • 原文地址:https://www.cnblogs.com/anuoruibo/p/3298546.html
Copyright © 2011-2022 走看看