Error:'length' 为空或不是对象
functionphpjs_viewpic(n_vid,input){varinput_view="_view_"+input;if(!n_vid||n_vid==""|...
function phpjs_viewpic(n_vid,input)
{
var input_view = "_view_"+input;
if(!n_vid || n_vid =="" || n_vid == "undefined")
{
getid(input_view).innerHTML = "<img src='images/nopic.gif' />";
return true;
}
var url = get_url('open,ajax_preview_img')+"idstring="+n_vid;
var msg = get_ajax(url);
if(msg == "empty")
{
phpjs_viewpic("",input_view);
return true;
}
var array = JSON.parse(msg);
//通过Ajax获取图片列表
var p_html = '<table><tr>';
for(var i=0;i<array.length;i++)
{
var tmp_i = i+1;
var srcurl = array[i]["url"];
if(!srcurl || srcurl == "" || srcurl == "undefined")
{
srcurl = "images/nopic.gif";
}
p_html += '<td><img src="'+srcurl+'" class="hand" onclick="phpjs_preview(\''+array[i]["id"]+'\')" /></td>';
if(tmp_i%8 == "")
{
p_html += "</tr><tr>";
}
}
p_html += "</tr></table>";
getid(input_view).innerHTML = p_html;
return true;
}
提示:Error:'length' 为空或不是对象 展开
{
var input_view = "_view_"+input;
if(!n_vid || n_vid =="" || n_vid == "undefined")
{
getid(input_view).innerHTML = "<img src='images/nopic.gif' />";
return true;
}
var url = get_url('open,ajax_preview_img')+"idstring="+n_vid;
var msg = get_ajax(url);
if(msg == "empty")
{
phpjs_viewpic("",input_view);
return true;
}
var array = JSON.parse(msg);
//通过Ajax获取图片列表
var p_html = '<table><tr>';
for(var i=0;i<array.length;i++)
{
var tmp_i = i+1;
var srcurl = array[i]["url"];
if(!srcurl || srcurl == "" || srcurl == "undefined")
{
srcurl = "images/nopic.gif";
}
p_html += '<td><img src="'+srcurl+'" class="hand" onclick="phpjs_preview(\''+array[i]["id"]+'\')" /></td>';
if(tmp_i%8 == "")
{
p_html += "</tr><tr>";
}
}
p_html += "</tr></table>";
getid(input_view).innerHTML = p_html;
return true;
}
提示:Error:'length' 为空或不是对象 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询