草庐IT

undefined-symbol

全部标签

javascript - getElementsByClassName 产生错误 "undefined"

这个问题在这里已经有了答案:WhatdoquerySelectorAllandgetElementsBy*methodsreturn?(12个答案)关闭8年前。我有几个textboxes类output。我希望能够将它们的值作为纯HTML列表打印在div中,带有IDcombined。现在,我有以下代码:functiondoCombine(){document.getElementById('combined').innerHTML=document.getElementsByClassName('output').value+",";}但是,当我运行该函数时,我收到错误消息undefin

Javascript 类型错误 : Cannot read property 'indexOf' of undefined

在这段代码中,我想从cart_products数组中删除一个元素。varcart_products=["17^1","19^1","18^1"];varproduct=17;$.each(cart_products,function(key,item){if(item.indexOf(product+"^")!==-1){cart_products.splice(key,1);}});但我在GoogleChrome控制台中收到此错误:UncaughtTypeError:Cannotreadproperty'indexOf'ofundefined代码有问题吗?感谢您的帮助。

javascript - 为什么匹配的子字符串在 JavaScript 中返回 "undefined"?

我今天在JavaScript(WindowsVista上的Firefox3)中做一些正则表达式时遇到了一个奇怪的行为。varstr="format_%A";varformat=/(?:^|\s)format_(.*?)(?:\s|$)/.exec(str);console.log(format);//["format_%A","%A"]console.log(format[0]);//"format_undefined"console.log(format[1]);//Undefined正则表达式没有错。如您所见,它已匹配第一个console.log调用中的正确部分。InternetE

javascript - Angular .js : directive object in scope is always undefined

编辑:fork了@EliteOctagon的plunker,奇怪的是它在工作!无法理解为什么下面的代码不是。http://plnkr.co/edit/y8uvulA9RHQ1Y9mwzin1EDIT2:fork了之前的plunker并向Controller的逻辑添加了$timeout,它停止工作了!猜猜这真的是加载顺序。查看:http://plnkr.co/edit/ivmGQmEHTatNzBWhppyf我是Angular的新手,无法理解指令隔离范围。我需要创建一个指令来打印出在我的页面中,包含关于ViewController中的对象的信息。我试图做的是隔离指令范围并通过具有双向绑定

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

我有这个jjavascript来调整iframe的大小:$(function(){variFrames=$('iframe');functioniResize(){for(vari=0,j=iFrames.length;i在chrome中,这里有问题:if($.browser.safari||$.browser.opera){我收到这个错误有什么原因吗?我使用的是最新的JQuery?谢谢 最佳答案 您可能正在使用jQuery1.9或更高版本,在这种情况下$.browser自1.3起被弃用后被正式删除。您可以使用jQuerymigra

javascript - UnderscoreJS 未捕获类型错误 : Cannot call method 'replace' of undefined

在我的BackboneView中我有:noteTemplate:_.template($('#note-template').html()),这是抛出这个错误。模板是:Created3daysagoIn3hours我很困惑,因为这在我的控制台中有效:>>_.template($('#note-template').html());函数(n){returne.call(this,n,w)}完整代码如下:App.Views.Index=Backbone.View.extend({el:$("div.reminders"),todays:$("span.today"),tomorrows:$

JavaScript 运行时错误 : '$' is undefined

有人可以帮助解决我代码中的这个错误吗?当我在InternetExplorer中启动网站时出现此错误:JavaScriptruntimeerror:'$'isundefined这是代码,请帮助我在java脚本中需要更改什么?div.world_map_container#transparent_map{border:mediumnone;height:auto;position:absolute;width:auto;z-index:30;}ulli{display:none;position:absolute;text-indent:-9999px;z-index:20;}#home_

javascript - D3 饼图 : Uncaught Type Error - Cannot read property 'pie' of undefined

我正在尝试基于此resource创建一个d3饼图.但是,我收到以下错误:UncaughtTypeError-Cannotreadproperty'pie'ofundefined我的代码:classPieChartextendsReact.Component{constructor(){super();//-Thisiswheretheerrorisoccuring!this.pie=d3.layout.pie().value((d)=>d.value);this.colors=d3.scale.category10();}arcGenerator(d,i){return();}rend

javascript - 未捕获的类型错误 : Cannot call method 'request' of undefined

在我的javascript代码中,我不断收到以下错误:未捕获的类型错误:无法调用未定义的方法“请求”我的Javascript在下面。如有任何帮助,我们将不胜感激!myJsonStore={store1:newExt.data.JsonStore({root:'rootstore1',fields:['UserID','UserName']})};//------Mypanel------items:[{xtype:'combo',id:'UName',fieldLabel:'User',emptyText:'All',store:myJsonStore.store1,displayFi

javascript - 为什么 "undefined"== undefined 不是真的?

==运算符真的很有趣。正如人们所想的那样,它是usuallydoesn'tbehave。这让我调查了冰山一Angular下面究竟发生了什么,根据MDN的说法,情况如下:Ifthetwooperandsarenotofthesametype,JavaScriptconvertstheoperandsthenappliesstrictcomparison.Ifeitheroperandisanumberoraboolean,theoperandsareconvertedtonumbersifpossible;elseifeitheroperandisastring,theotheroper