问题标签 [typeerror]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
2 回答
1515 浏览

javascript - Javascript 表达式的结果不是对象

使用它来摆脱一个烦人的小“由”框,但它一直说“TypeError:表达式'divs [i]'[undefined]的结果不是一个对象。” 我如何解决它。

0 投票
2 回答
2088 浏览

ruby-on-rails - Ruby 方法返回 nil,自引用有问题

我已经定义了一个名为 ccy 的方法,它接受一个数字num,确定货币(父 Record 模型的一个属性)并返回该数字乘以一个转换因子。在这种情况下,Self 指的是一个 Setting,它有许多自己的属性并且属于 Record。该方法在下面的设置模型中定义:

但是,这不起作用,因为在做了一些测试之后,我发现它self.record.currency是 nil。因此,例如,当我尝试self.ccy(100)在 rails 应用程序中执行类似操作时,我收到以下错误:

或者这个,如果我在 nil 元素上使用某种运算符:

我在网上看了一会儿,我似乎无法弄清楚如何解决这个问题。帮助表示赞赏!

0 投票
1 回答
879 浏览

javascript - JavaScript Chrome 问题

我有这个脚本:

此代码打开一个文件(现在是 lineData.txt)并将其放在文本区域中。此代码适用于 Firefox 和 IE,但不适用于 Chrome。

问题出在

控制台在那一行告诉我:

未捕获的类型错误:无法读取未定义的属性“正文”

我该怎么做才能让它在 Chrome 上运行?

0 投票
2 回答
4387 浏览

python - 如何解决 Python TypeError?

这是我下面的代码,我尝试将数据从一个数据库加载到另一个数据库。我相信一切正常,但发生错误,我不知道这意味着什么。

这是错误:

-------------------------------------------------- ----------------------

好的,这是我的编辑:

现在,这是我的新代码

抱歉,之前发生的错误是错误的,因为我忘记了查询后面的“=”,这是真正的错误

0 投票
5 回答
292 浏览

c - 混合 bool 和 ret 代码是不是一个坏主意

我有一些程序大量使用带有错误代码枚举的库。

0(枚举的第一个值)是成功而 1 是失败的那种。在某些情况下,我有自己的帮助函数,它们返回指示错误的 bool,在其他情况下,我会冒泡错误枚举。不幸的是,有时我把一个误认为另一个,事情就失败了。

你会推荐什么?我是否错过了一些关于 gcc 的警告,这些警告会在这些情况下发出警告?

PS 返回一个与我的代码完全无关的错误代码感觉很奇怪,尽管我想我可以返回 -1 或其他一些无效值。

0 投票
2 回答
24671 浏览

javascript - 未捕获的类型错误:对象# has no method 'dispatchEvent'

I'm trying to combine Drupal with Picasa web integrator.

I have these 3 lines in the se

I'm trying to combine Drupal with Picasa web integrator.

I have these 3 lines in the section of my page.tpl.php:

I also added this script to my head section, to test an album (the username and albumname are not important, I tested it offline with my username and album and that worked fine):

Google Chrome gives me this error when I try it on my Drupal-page:


having problems passing array values

I'm building a PHP program that basically grabs only image links from my twitter feed and displays them on a page, I have 3 components that I have set up that all work fine on their own.

The first component is the twitter oauth component which grabs the tweet text and creates an array, this works fine by itself.

The second is a function that processes the tweets and only returns tweets that contain image links, this as well works fine.

The program breaks down during the third section when the links are processed and an image is displayed, I had no issues running this on its own and from my attempts to trouble shoot it appears that it breaks down at the $images(); array, as that array is empty.

I'm sure I've made a silly mistake but I've been trying to find this for over a day now and can't seem to fix it. Any help would be great! Thanks guys!

code:

0 投票
1 回答
169 浏览

jar - 从 JRuby 脚本启动 Java 抛出 TypeError: no public constructors for Java

我有一个试图从 JRuby 脚本启动的 Java 应用程序。我一直在谷歌搜索/拍摄/迭代这么多解决方案 - 我的“基本”脚本是:

这会引发以下错误:

而且我发现这也会引发同样的错误:

我的应用程序的主要构造函数是:

那么我需要做什么才能让我的脚本简单地启动我的应用程序?任何/所有建议和指示将不胜感激!

0 投票
1 回答
36177 浏览

python - Python TypeError:找不到所需的参数“源”(位置1)

我收到一个错误:TypeError: Required argument 'source' (pos 1) not found 但我不知道这意味着什么:/。谁能让我走上正轨?我的代码是:

基本上,它会在目录中打开一个数字文件,读取它们,然后查找电子邮件地址并将它们写入数据库。

0 投票
7 回答
644939 浏览

javascript - 未捕获的类型错误:无法读取未定义的属性“值”

我有一些 JavaScript 代码给出了这个错误

代码

这个错误是什么意思?

0 投票
1 回答
4043 浏览

javascript - document.getElementById 抛出 TypeError

我对 Javascript 有点陌生。我正在编写这个虚拟脚本来测试我的大页面需要什么。我想,最简单的是,获取 href 的值,然后更改 href 的值,然后再次查看它。为了简单起见,现在我删除了更改 href 值的部分,并且只调用了两次属性值。但是第二次访问属性值时,它显示了我在下面发布的错误。我发布了两个错误日志,一个来自 Firebug,另一个来自 Dragonfly(来自 Opera)。

任何帮助将不胜感激。谢谢。

我对脚本的另一个问题是它永远不会完成加载。我总是在标签标题中看到(在 Firefox 3.6.8 中)小加载标志。它不会打扰我这么多,但如果有人有想法请告诉我。

错误日志:
1. Firebug -> document.getElementById("1") is null

2. Dragonfly ->
Uncaught exception: TypeError: Cannot convert 'document.getElementById("1")' to object


在file://localhost/D:/Chicago%20pics/website%20pics/website%20root/trial5.htm:
var newnew21 = document.getElementById("1")中 hrefvalue() 的第 8 行第 0 列抛出错误。 childNodes[0].getAttribute("href");
从(事件)中的第 1 行第 0 列调用:hrefvalue()

再次感谢所有的鱼:D