Microsoft JScript 运行时错误: 对象不支持此属性或方法 var con = $("#selectdatatables #tr" + tableArrayEN + " #td" + tableArrayEN).text().trim(); //condition这句报错,为什么呢 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 减少或改变"#selectdatatables #tr" + tableArrayEN + " #td" + tableArrayEN试试看 改成var con = $("#td" + tableArrayEN).text().trim(); 还不行 alert(#selectdatatables #tr" + tableArrayEN + " #td" + tableArrayEN);//看看是不是你要的selector 不能alert,同样报错: 运行时错误: 对象不支持此属性或方法 我想你写的 tr 和 td 应该不是ID名称吧 如果不是 那就把 # 去了 tableArrayEN 如果是 那就要加上 是ID,为了区别与其他id,ID分两个部分,前面的ID加上后面传过来的值tableArrayEN tableArrayEN的定义处可能有ie不支持的方法!!! 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....... html中什么时候调用showfield,参数呢? 好吧,我把代码全贴出来,求高手哇 //产生需要查询的表 $("#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); }); 问题找到了,trim(s)与C#中不一样 jquery data 问题 jquery获取html对象,是否可以获取某个文字为对象 跪求一个javascript的工具 select多选删除的JS怎么写? 新浪首页各栏目中鼠标滑过就改变成对应的栏目内容是如何实现的? .net 保存按钮点击一次后遮罩不能在点击 数据保存完成后遮罩消失 有没有函数功能类似于VB中的删除前后倒空格Trim()函数? confirm()方法弹出的对话框的默认焦点是在yes上的。如何改在no上。 求大虾帮忙看下这段是干什么用的。 求助!为森么我的react跑不起来呀qaq 父页面能否调用iframe引用的子页面中定义的function jQuery下的一个小问题
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
.......
$("#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);
});