• 小记


    1. Jquery 取服务器控件的ID问题

    <input type="hidden" id="hidweb" runat="server" />

    若将其放入用户控件中或继承自母版页的页面中,其ID值前面会自动加上其他值,变成一长串(如:column0_webcontrol_hidweb), 此时得取其ClientID,
    JS中:

    document.getElementById("<%=hidweb.ClientID %>");

    Jquery中可以用:

    $j('*[id$=hidweb]').val();

    2. $(this).attr('checked')在不同版本的Jquery中选中和未选中返回值的问题
       原来Jquery v1.6以后$(this).attr('checked')就返回checked和undefined,

       v1.6以前返回true和false, v1.6以后可以使用$(this).is(':checked')或者$(this).prop('checked')来返回true和false

    3. JS中动态拼装JSON对象

        若要拼装成类似对象[

                                     {

                                           "Name": "aaa",

                                           "Contry": "China",

                                           "Area": ["AA", "BB"]

                                     }

                                 ]

        可以如下:

        

    var peoples =[];
    var people = {};
    var area = []; 
    
    people['Name'] = "aaa";
    people['Country'] = "China";
    area.push('AA');
    area.push('BB');
    people['Area'] = area;
    
    peoples.push(people);
    
    // JSON 对象转成字符串
    var objectString = JSON.stringify(peoples); // 字符串转成JSON 对象
    var
    people = JSON.parse(objectString);

    4. 关于Response.Redirect的 false 与 true

      Response.Redirect(URL, false) :    - Client is redirected to a new page and the current page on the server will keep processing ahead.

      Response.Redirect(URL, true) :    - Client is redirected to a new page but the processing of the current page is aborted.

  • 相关阅读:
    SQLite Select语句的意外发现
    和一个经理人谈话的经典语句
    [转]如何动态增长一个数组的大小
    [转]Spring AOP中文教程
    为Wildfish框架增加方法调用日志[Aspectsharp]
    第四周学习心得
    《大道至简:软件工程实践者的思想》观后感
    第三周学习心得
    暑假第一周Java学习心得
    第二周学习心得
  • 原文地址:https://www.cnblogs.com/notebook2011/p/3414606.html
Copyright © 2020-2023  润新知