如何在Internet Explorer中使用控制台日志记录? [英] How can I use console logging in Internet Explorer?

查看:1041
本文介绍了如何在Internet Explorer中使用控制台日志记录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有IE控制台记录器吗?我试图记录一堆测试/断言到控制台,但我不能这样做在IE。

解决方案

您可以通过启动开发工具(F12)访问IE8脚本控制台。点击脚本标签,然后点击右侧的控制台。



您可以在JavaScript代码中执行以下操作:

 < script type =text / javascript> 
console.log('some msg');
console.info('information');
console.warn('some warning');
console.error('some error');
console.assert(false,'YOU FAIL');
< / script>此外,您还可以通过调用 console.clear()清除控制台。





注意:您必须先启动开发人员工具,然后刷新页面才能使用。 / p>

Is there a console logger for IE? I'm trying to log a bunch of tests/assertions to the console but I can't do this in IE.

解决方案

You can access IE8 script console by launching the "Developer Tools" (F12). Click the "Script" tab, then click "Console" on the right.

From within your JavaScript code, you can do any of the following:

<script type="text/javascript">
    console.log('some msg');
    console.info('information');
    console.warn('some warning');
    console.error('some error');
    console.assert(false, 'YOU FAIL');
</script>

Also, you can clear the Console by calling console.clear().

NOTE: It appears you must launch the Developer Tools first then refresh your page for this to work.

这篇关于如何在Internet Explorer中使用控制台日志记录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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