javascript运行时错误 [英] javascript Run Time Error

查看:155
本文介绍了javascript运行时错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

无法获取未定义或空引用的属性'childNodes'



在IE9中,上传文档时没有错误

相同代码在IE10文档正在加载。但不显示在网格中上面的错误正在无法获取未定义或空引用的属性'childNodes'

Unable to get property 'childNodes' of undefined or null reference

In IE9 there is no Error is Coming While Uploading an Document
Same Code In IE10 Document is Loading. But Not Display in grid The Above Error is Coming " Unable to get property 'childNodes' of undefined or null reference "

function GetEqrDataUploadFiles()
{
var upload=$("#files").data("KendoUpload");
//   in this line Error is coming     " Unable to get property 'childNodes' of undefined or null reference "

var s = upload.wrapper[0].childNodes[2].childNodes.length;

var a = new Array();
for (i = 0; i < s; i++)
{
if (document.all) {
a.push(upload.wrapper[0].childNodes[2].childNodes[i].innerText);
}
else {
a.push(upload.wrapper[0].childNodes[2].childNodes[i].textContent);
}
}
return a;
}

推荐答案

#files)。data( KendoUpload);
// 此行错误无法获取未定义或空引用的属性'childNodes'

var s = upload.wrapper [ 0 ]。 childNodes [ 2 ]。childNodes.length;

var a = new 阵列();
for (i = 0 ; i< s; i ++)
{
if document .all){
a.push(upload.wrapper) [ 0 ]。childNodes [ 2 ]。childNodes [i] .innerText);
}
else {
a.push(upload.wrapper [ 0 ]。childNodes [ 2 ]。childNodes [i] .textContent);
}
}
返回 a;
}
("#files").data("KendoUpload"); // in this line Error is coming " Unable to get property 'childNodes' of undefined or null reference " var s = upload.wrapper[0].childNodes[2].childNodes.length; var a = new Array(); for (i = 0; i < s; i++) { if (document.all) { a.push(upload.wrapper[0].childNodes[2].childNodes[i].innerText); } else { a.push(upload.wrapper[0].childNodes[2].childNodes[i].textContent); } } return a; }


我想我找到了你...你试图在一个数组中推送选定的文件名......

问题是Kendo UI的呈现因浏览器而异,因此您必须使用Kendo UI API进行特定控制(在我们的例子中为Uploader),而不是尝试使用纯JavaScript来访问它!



http://docs.telerik.com/kendo- ui / api / web / upload [ ^ ]



I think I got you... You try to push selected file names in an array...
The problem is that the rendering of Kendo UI is different from browser to browser, so you have to use Kendo UI API for the specific control (Uploader in our case) and not try to access it using plain JavaScript!

http://docs.telerik.com/kendo-ui/api/web/upload[^]


#files)。kendoUpload({
upload:onUpload
});

function onUpload(e){
// 包含有关上传文件的信息的数组
var files = e.files;
("#files").kendoUpload({ upload: onUpload }); function onUpload(e) { // Array with information about the uploaded files var files = e.files;


这篇关于javascript运行时错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆