var con = $("#selectdatatables #tr" + tableArrayEN + " #td" + tableArrayEN).text().trim(); //condition这句报错,为什么呢

解决方案 »

  1.   

    减少或改变"#selectdatatables #tr" + tableArrayEN + " #td" + tableArrayEN试试看
      

  2.   

    改成var con = $("#td" + tableArrayEN).text().trim(); 还不行
      

  3.   

    alert(#selectdatatables #tr" + tableArrayEN + " #td" + tableArrayEN);//看看是不是你要的selector
      

  4.   

    不能alert,同样报错: 运行时错误: 对象不支持此属性或方法
      

  5.   

    我想你写的 tr 和 td 应该不是ID名称吧  如果不是 那就把 # 去了 
    tableArrayEN 如果是 那就要加上
      

  6.   

    是ID,为了区别与其他id,ID分两个部分,前面的ID加上后面传过来的值tableArrayEN 
      

  7.   

    tableArrayEN的定义处可能有ie不支持的方法!!!
      

  8.   

    function showfield(tableArrayCN, tableArrayEN) {
        var html = "<div style='overflow-y:scroll;height:300px;'><table class='tableCss' style='width:100%' id='datatablename'>";
        html += "<tr><th>中文列名</th><th>英文列名</th><th>选择</th><th>筛选条件</th><th>重命名列</th></tr>";
        for (var i = 0; i < field.length; i++) {
            if (field[i].DisPlayName == tableArrayCN) {
                html += "<tr>";
                html += "<td style='width:150px;'>" + field[i].TableFieldCN + "</td>";
                html += "<td style='width:150px;'>" + field[i].TableFieldEN + "</td>";
                html += "<td style='width:80px;text-align:center;'><input type='CheckBox' id='" + field[i].TableName + "' value='" + field[i].TableFieldEN + "' fieldtype='" + field[i].FieldType + "'/></td>";
                html += "<td style='width:130px;text-align:center;'><input type='text' id='" + field[i].TableName + "'/></td>";
                html += "<td style='width:130px;text-align:center;'><input type='text' id='rename" + field[i].TableName + "'></td>";
                html += "</tr>";
            }
        }
        html += "<tr><td colspan='5' align='left'>";
        html += "<a id='selectall' href='#'>全选</a><a id='selectnone' style='padding-left: 15px' href='#'>全不选</a><a id='selectinvert' href='#' style='padding-left: 15px'>反选</a>";
        html += "</td></tr>";
        html += "</table></div>";
        var choose = "(筛选条件:空、=、!=、<、>、<=、>= 日期格式:2011/09/09)";
        var conall = ""; //保存附加语句
        var strall = ""; //保存查询语句
        var lineall = ""; //保存所有列名
        ShowMsg(html, 800, tableArrayCN + choose, function () {
                });
    ......
           $(document).ready(function () {
            if ($("#field").css("display") == "block") {
                var con = $("#selectdatatables #tr" + tableArrayEN + " #td" + tableArrayEN).text().trim(); //condition
    .......
      

  9.   

    html中什么时候调用showfield,参数呢?
      

  10.   

    好吧,我把代码全贴出来,求高手哇 //产生需要查询的表
        $("#tableinfo").click(function () {
            var html = "<table class='tableCss' style='width:100%' id='datatablename'>";
            for (var i = 0; i < ((table.length / 4) + (table.length % 4 > 0 ? 1 : 0)); i++) {
                html += "<tr>";
                html += "<td style='width:25%;'><input type='CheckBox' id='" + table[i * 4].TableName + "' value='" + table[i * 4].DisPlayName + "'/>" + table[i * 4].DisPlayName + "</td>";
                html += "<td style='width:25%;'><input type='CheckBox' id='" + table[i * 4 + 1].TableName + "' value='" + table[i * 4 + 1].DisPlayName + "'/>" + table[i * 4 + 1].DisPlayName + "</td>";
                html += "<td style='width:25%;'><input type='CheckBox' id='" + table[i * 4 + 2].TableName + "' value='" + table[i * 4 + 2].DisPlayName + "'/>" + table[i * 4 + 2].DisPlayName + "</td>";
                html += "<td ><input type='CheckBox' id='" + table[i * 4 + 3].TableName + "' value='" + table[i * 4 + 3].DisPlayName + "'/>" + table[i * 4 + 3].DisPlayName + "</td>";
                html += "</tr>";
            }
            html += "<tr><td colspan='4' align='right' style='padding-right: 15px'>";
            html += "<a id='selectall' style='padding-right: 15px' href='#'>全选</a><a id='selectnone'  style='padding-right: 15px' href='#'>全不选</a><a id='selectinvert' href='#'>反选</a>";
            html += "</td></tr>";
            html += "</table>";
            ShowMsg(html, 600, "请选择需要查询的表", function () {
                var tabledataCN = ""; //保存选中表的中文名
                var tabledataEN = "";
                $("#datatablename input:checked").each(function () {
                    tabledataCN += $(this).attr("value") + "&"; //获取所有选中表的中文名
                    tabledataEN += $(this).attr("id") + "&"; //获取所有选中表的英文名
                });
                showfielddata(tabledataCN, tabledataEN);
            });
      

  11.   

    问题找到了,trim(s)与C#中不一样