zoukankan      html  css  js  c++  java
  • JQuery 杂项

    1、用jquery从多个条件中 取某个值  //SB.configXml为配置文件

    var showCheckedTicker = $j(SB.configXml).find("root tools t[id='PG'][type='PA']").attr("showChecked");

    2将条件符合的checkbox选中,匹配条件的数据保存在TableCheckedTicker中,document为上下文,或者某个div也可以$('#divid')

    $j(":checkbox[id='chk" + TableCheckedTicker[i] + "']", document).attr("checked",true); 

    3数组出数据,从数组selectIndex.pop中出数据

    AM_TABLE.selectIndex.pop();

    4、正则表达式

    var reg = new RegExp("\\*","g");  与 var reg = /\*/g; 是等价的

    str = str.replace(reg," ");//将字符串中的所有*替换成空格

    5、遍历查询xml的数据,进行处理

     jQuery(SB.postData).find("Securities Security").each(function ()
    {
        var node=jQuery(this);
        var secid = node.attr("securityid");
        var ticker = node.attr("ticker");
        var dtcccode = node.attr("dtcccode");                      
       
        if(dtcccode != null && dtcccode != "")
        {
            if((secid==undefined || secid == "undefined") && (ticker==undefined|| ticker == "undefined"))
            {                                  
                node.remove();
            }
            else
            {
                node.removeAttr("dtcccode");
            }                             
          
        }
    });            

    6在xml中循环遍历查找所有的某个节点

    jQuery(SB.postData).find("Security").each(function ()
    {
        var node=jQuery(this);
        var secid = node.attr("securityid");
        var ticker = node.attr("ticker");
        var dtcccode = node.attr("dtcccode"); 
        var isMappingDtcc = node.attr("isMappingDtcc");
        var isDtccCode = node.attr("isDtccCode");
        var dtccKey = node.attr("Dtcckey");
                             
       
        if(isMappingDtcc == "1" && (isDtccCode != ""|| isDtccCode ==null ||isDtccCode ==undefined || isDtccCode=="undefined" ))
        {
            if((secid==undefined || secid == "undefined") && (ticker==undefined|| ticker == "undefined"))
            {                                  
                node.remove();
            }
            else
            {
                node.removeAttr("dtcccode");
                node.removeAttr("isMappingDtcc");
                node.removeAttr("Dtcckey");
            }                             
          
        }
    });

    7、得到iframe之外的一个html控件的值

    I have an iframe and I wrote this code

    window.parent.document.getElementById('parentPrice').innerHTML 
    to access parent element. How to get the same result using jquery?
    Or how to access iFrame parent page using jquery?

    答案:$('#parentPrice', window.parent.document).html();  //jquery object

    $('#parentPrice', window.parent.document)[0].Id;  // dom object

     8.blog:

    http://www.cnblogs.com/zhangziqiu/tag/jQuery/

  • 相关阅读:
    nodejs
    flask中flash(闪现)的使用
    flask中logger日志的使用
    flask中session的使用
    flask开启调试模式
    flask中静态文件的引入
    flask中模板引入
    python web开发屠龙刀flask
    python操作excel基础1-环境搭建
    php算法-dijkstra
  • 原文地址:https://www.cnblogs.com/vihone/p/1962479.html
Copyright © 2011-2022 走看看