如何在 Google Chrome 的内联 Javascript 中设置断点? [英] How to set breakpoints in inline Javascript in Google Chrome?

查看:31
本文介绍了如何在 Google Chrome 的内联 Javascript 中设置断点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在 Google Chrome 中打开开发者工具时,我看到了各种功能,如配置文件、时间线和审核,但缺少基本功能,例如能够在 js 文件中以及在 html 和 javascript 代码中设置断点!我尝试使用 javascript 控制台,它本身就有问题——例如,一旦遇到 JS 错误,除非我刷新整个页面,否则我无法摆脱它.有人可以帮忙吗?

When I open Developer Tools in Google Chrome, I see all kinds of features like Profiles, Timelines, and Audits, but basic functionality like being able to set breakpoints both in js files and within html and javascript code is missing! I tried to use the javascript console, which itself is buggy - for example, once it encounters a JS error, I cannot get out of it unless I refresh the whole page. Can someone help?

推荐答案

使用源选项卡,您可以在那里设置 JavaScript 中的断点.在其下方的目录树中(其中带有向上和向下箭头),您可以选择要调试的文件.您可以通过按同一选项卡右侧的恢复来解决错误.

Use the sources tab, you can set breakpoints in JavaScript there. In the directory tree underneath it (with the up and down arrow in it), you can select the file you want to debug. You can get out of an error by pressing resume on the right-hand side of the same tab.

这篇关于如何在 Google Chrome 的内联 Javascript 中设置断点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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