将调试消息写入Javascript控制台 [英] Writing Debug Messages to the Javascript Console

查看:58
本文介绍了将调试消息写入Javascript控制台的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨!

有没有办法将消息写入javascript控制台?就像一个

debug.write()方法?

谢谢!

离子

解决方案

如果你在谈论Mozilla / Firefox javascript控制台,那么在mozillazine上有一个很好的维基文档:

a:

http://kb.mozillazine.org/JavaScript_Console


看起来最简单的方法是这样做:

consoleService.logStringMessage(" Hello world!");
< blockquote class =post_quotes>有没有办法将消息写入javascript控制台?




Nathan,

谢谢。我无法解决这个问题。我得到了

获取属性的权限UnnamedClass.classes

我认为该服务适用于XUL应用程序。用JavaScript写入它有没有

方式?在JavaScript控制台本身中只有''消息

'的过滤器,因此它似乎想要写入



Ion


好的,Neil在
中提供答案 http:// groups -beta.google.com/group/...ef5e734f6f2123

var message =" Hello,world!";

setTimeout(message,0 );


,因为Hello,world!作为一个方法调用是不可解析的,这会得到

记录为错误[我得到''缺失;在陈述''之前,但是对于一个单词的消息,它可能会有所不同。


Hi!
Is there a way to write messages to the javascript console? Like a
debug.write() method?
Thanks!
Ion

解决方案

if you''re talking about the Mozilla/Firefox javascript console, there''s
a pretty good wiki document over at mozillazine:

http://kb.mozillazine.org/JavaScript_Console

looks like the easiest way is to do it like this:

consoleService.logStringMessage("Hello world!");

Is there a way to write messages to the javascript console?




Nathan,
Thanks. I couldn''t get that to work. I get
Permission denied to get property UnnamedClass.classes
I think that service is intended for XUL applications. Is there no
way to write to it with JavaScript? There''s a filter for ''messages
only'' in the JavaScript Console itself, so it seems to want to be
written to.
Ion


OK, Neil provides the answer in
http://groups-beta.google.com/group/...ef5e734f6f2123
var message = "Hello, world!";
setTimeout(message, 0);

since "Hello, world!" isn''t resolvable as a method call, this gets
logged as an error [I get ''Missing ; before statement'', but it would
probably be different for a single word message.]


这篇关于将调试消息写入Javascript控制台的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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