写了个JS但是提示找不到split方法 如题 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 var result = "";var laststr = "";var showCount = 40;$(document).ready(function() { var corpname = $("#txtCorpName").val(); getJson1(corpname);});function showDiv(o, content) { showCount = 40; result = content; if ($(o).val() != laststr) { var isShow = false; tabletrcount = 0; var tablestr = "<table cellspacing='0' cellpadding='2px' id='contenttable' style='width:100%;cursor:default;text-align:left;'>"; var userlist = result.split('|'); for (var i = 0; i < userlist.length; i++) { if (userlist[i].indexOf($(o).val().toString().toLowerCase()) >= 0) { tablestr += "<tr onclick=\"$('#" + o.id + "').val(this.childNodes[0].innerHTML);str1=this.childNodes[0].innerHTML;$('#similarcontent').fadeOut('slow');getJson(str1);$('#txtVName').val(str1);\" onmouseover=\"currentcolor=this.style.backgroundColor;this.className='mouseover';\" onmouseout=\"this.style.backgroundColor=currentcolor;this.className='mouseout'\">" + userlist[i].toString() + "</tr>"; isShow = true; tabletrcount++; if (tabletrcount > showCount) { tablestr += "<tr onclick='javascript:showMore(" + o.id + ");'><td>更多...</td></tr>"; break; } } } tablestr += "</table>"; laststr = $(o).val(); if (isShow) { $("#similarcontent").hide(); $("#similarcontent").html(tablestr); $("#similarcontent").fadeIn("slow"); PosDiv(o); if (tabletrcount > 7) { $("#similarcontent").css("height", "200px"); $("#similarcontent").css("overflow-y", "scroll"); } } else { $("#similarcontent").html(""); $("#similarcontent").hide(); } }}function autocorp(o) { result = $("#corp").val(); showDiv(o,result);} var userlist = result[0].split('|');这样试试~· function autocorp(o) { result = $("#corp").val(); //alert(result); result变量有值吗? showDiv(o,result);} $("#corp").val();这个#corp是字段吗?如果不是就不一定有val()方法。alert($("#corp").val())看下是不是null 那就检查一下id名称有没有写错,autocorp()是在#corp控件前调用的还是后面调用的。 菜鸟问:js中变量之间传值问题 select 赋值、取值问题。 大家帮我看一下错在哪里啊???? http://www.dodoor.cn/的页面效果是怎么实现的。 求助,实时根据当前选择的日期显示当前周所有日期 document.write()函数为什么显示不出内容来呢? 在JAVAScript的函数中用来判断是否是时间的是那个函数,谢谢! 用border="1"设置的框太丑陋了,求一个边框是平面的并且较粗的黑体的写法,表格中间的线条也是粗的 求救 树形菜单问题 js弹出可拖动的DIV层,在IE和火狐下不兼容的问题 Jquery多条件筛选的问题
var result = "";
var laststr = "";
var showCount = 40;
$(document).ready(function() {
var corpname = $("#txtCorpName").val();
getJson1(corpname);
});function showDiv(o, content) {
showCount = 40;
result = content;
if ($(o).val() != laststr) {
var isShow = false;
tabletrcount = 0;
var tablestr = "<table cellspacing='0' cellpadding='2px' id='contenttable' style='width:100%;cursor:default;text-align:left;'>";
var userlist = result.split('|');
for (var i = 0; i < userlist.length; i++) {
if (userlist[i].indexOf($(o).val().toString().toLowerCase()) >= 0) {
tablestr += "<tr onclick=\"$('#" + o.id + "').val(this.childNodes[0].innerHTML);str1=this.childNodes[0].innerHTML;$('#similarcontent').fadeOut('slow');getJson(str1);$('#txtVName').val(str1);\" onmouseover=\"currentcolor=this.style.backgroundColor;this.className='mouseover';\" onmouseout=\"this.style.backgroundColor=currentcolor;this.className='mouseout'\">" + userlist[i].toString() + "</tr>";
isShow = true;
tabletrcount++;
if (tabletrcount > showCount) {
tablestr += "<tr onclick='javascript:showMore(" + o.id + ");'><td>更多...</td></tr>";
break;
}
}
}
tablestr += "</table>";
laststr = $(o).val();
if (isShow) {
$("#similarcontent").hide();
$("#similarcontent").html(tablestr);
$("#similarcontent").fadeIn("slow");
PosDiv(o);
if (tabletrcount > 7) {
$("#similarcontent").css("height", "200px");
$("#similarcontent").css("overflow-y", "scroll");
}
}
else {
$("#similarcontent").html("");
$("#similarcontent").hide();
}
}
}
function autocorp(o) {
result = $("#corp").val();
showDiv(o,result);
}
result = $("#corp").val();
//alert(result); result变量有值吗?
showDiv(o,result);
}
alert($("#corp").val())看下是不是null