草庐IT

READ_EXTERNAL_STORAGE

全部标签

Javascript 未捕获类型错误 : Cannot read property '0' of undefined

我知道有很多与此错误相关的问题,我已经检查了其中的大部分,但没有一个能帮助我解决我的问题。(这看起来很容易调试...)我有一个数组(一开始是空的):varwords=[];我的函数hasLetter,检查我们是否在数组(我在这里称之为:d)单词中找到一个字母(对象)。functionhasLetter(letter,d){//ifwords[0]notnullshouldreturnobjectofletter"a",herewegetting//theindexoftheletter(sinceasciiof"a"is97,Isubstract97)varascii=letter.c

javascript - 未捕获的类型错误 : Cannot read property 'name' of undefined

我尝试使用facebookapi将数据提取到表单输入中。现在,一切都很顺利,直到我还尝试获取当前用户的位置。如果当前用户分享了他的位置(他住在哪里),那么我就没有问题。但是,如果用户没有在Facebook上分享他的位置,我会收到一个错误:未捕获的类型错误:无法读取未定义的属性“名称”这是我一直在使用的代码。如果您有解决方法,请在此处发表评论:)//AdditionalJSfunctionsherewindow.fbAsyncInit=function(){FB.init({appId:'*******',//AppIDstatus:true,//checkloginstatuscook

javascript - 如何检查 chrome.storage 中是否设置了 key ?

我正在制作GoogleChrome扩展,我想检查chrome.storage.sync中是否设置了key。示例:我想检查键'links':if(chrome.storage.sync.get('links',function(){//ifalreadysetitthennothingtodo}));else{//ifnotsetthensetit}我们将不胜感激任何有用的建议。 最佳答案 首先,由于chrome.storage是异步的,所以一切都必须在回调中完成-你不能在外面if...else,因为什么都不会被归还(还)。无论Chr

javascript - Uncaught Error : No Storage Bucket defined in Firebase Options.(网络)

我试图在firebase存储上上传文件(图像)。但它会显示一条错误消息“UncaughtError:Firebase选项中未定义存储桶。”.这是我的代码constfileUpBtn=document.getElementById('photoUpload');constselectFile=document.getElementById('selectedFile');constpostIt=document.getElementById('postIt');fileUpBtn.addEventListener('click',function(){selectFile.click()

javascript eval() 因 window.external.notify() 而失败,适用于 window.alert()

在WP8上,如果我执行(1):Microsoft.Phone.WebBrowserwb;wb.InvokeScript("eval","window.external.notify('abc');");它抛出“调用目标返回错误”,未知错误,hresult80020101。但是(2)wb.InvokeScript("eval","window.alert('abc');");工作正常,并显示消息框。和(3)wb.InvokeScript("eval","(function(){window.external.notify('abc');})();");也可以正常工作。我的问题是,阻止ev

javascript - d3-drag 0.3.0 - "Cannot read property ' button' of null"

我正在尝试将d3-drag与Canvas一起使用:select(canvas).call(drag().container(canvas).subject(partial(getNodeAtMouse,simulation,canvas)).on('start',someFunction))但是,当我实际尝试拖动时出现以下错误:Cannotreadproperty'button'ofnull从d3-drag(d3原始源代码)中的以下行functiondefaultFilter(){return!d3Selection.event.button;}如果我删除该函数(通过指定我自己的过滤器

javascript - "Cannot read property ' xxx ' of null"

我有一个包含子项的文档片段,我想循环(如果可能)。这会导致错误“无法读取null的属性‘xxx’”。我如何测试是否会出现这种情况? 最佳答案 您可能需要执行以下操作:if((documentFragment!==null)&&documentFragment.hasOwnProperty('xxx')){//handlepropertyxxxofdocumentFragmentasrequired} 关于javascript-"Cannotreadproperty'xxx'ofnull"

javascript - 未捕获的类型错误 : Cannot read property 'appendChild' of null

这个问题在这里已经有了答案:WhydoesjQueryoraDOMmethodsuchasgetElementByIdnotfindtheelement?(6个答案)关闭7个月前。我收到以下错误UncaughtTypeError:Cannotreadproperty'appendChild'ofnullmyRequest.onreadystatechange@script.js:20用我下面的代码//index.htmlSimplePageThisisanAJAXExample这是我的JavaScript文件//script.js//1.CreatetherequestvarmyReq

javascript - jQuery 验证与 Summernote 编辑器错误 : Cannot read property 'replace' of undefined

我正在使用MVC5通过summernote编辑器构建一个表单。Razor代码:@Html.LabelFor(model=>model.Content,htmlAttributes:new{@class="control-label"})@Html.EditorFor(model=>model.Content,new{htmlAttributes=new{@class="form-controlpost-content"}})@Html.ValidationMessageFor(model=>model.Content,"",new{@class="text-danger"})JS:$(

javascript - Rails 使用 'read more' 切换 chop

我有一个段落,我想通过单击“阅读更多”选项chop它,然后让它与其余内容一起滑动打开。内容来自数据库字段。这是我chop的内容:250,:omission=>'...ReadMore')%>我似乎无法找到一种方法来处理从数据库中提取的数据。我看到很多使用全文的例子,你想在一个单独的div标签中隐藏文本。但是,由于此内容来自数据库并且是动态的,所以我找不到有关如何执行此操作的任何信息。 最佳答案 你可以试试下面的方法250%>或者如果您更喜欢使用阅读更多链接250%>更新由于在Rails4中,link_to_function已被弃用,