Javascript 计时器偶尔运行 [英] Javascript Timer Runs Sporadically

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

问题描述

我正在开发一个消息系统并通过这里的讨论:webBrowser.Document.Write() Irregular性能 我决定在我的程序中用 Javascript 重写一些核心登录.

I am developing a messaging system and through discussion here: webBrowser.Document.Write() Irregular Performance I decided to rewite some of the core login in my program in Javascript.

此处看到的演示:http://nathantornquist.com/code/misc/index6.当您添加来自 John 的消息时,html 可以完美运行.一旦您添加了来自 Jack 的消息,计时器就会变得一团糟,John 消息上的日期颜色停止更改.

The demo seen here: http://nathantornquist.com/code/misc/index6.html runs perfectly when you are adding messages from John. As soon as you add a message from Jack, the timer gets messed up and the color of the date on John's messages stop changing.

谁能看到一个明确的原因?

Can anyone see a clear reason why?

推荐答案

您是否检查了 Firefox 或 Chrome 中的控制台?我检查了它并在单击添加来自杰克的消息"时出错

Did you check the console in Firefox or Chrome? I checked it out and got an error when clicking "Add a message from Jack"

Uncaught ReferenceError: black is not defined
switchColorindex6.html:74
(anonymous function)

黑色是应该定义的变量吗?

Is black a variable that should be defined?

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

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