Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我可以在 Chrome 的元素视图中看到代码,但在源代码中看不到代码,因为它是按document.write函数加载的。
document.write
在这种情况下如何设置断点?
我想您可以访问生成 document.write 的源代码,您可以像这样添加对“调试器”的调用:
<script> document.write('<sc' + 'ript> debugger; alert(0);</s' + 'cript>'); </script>
我在 chrome 上打开了调试器,它将停止执行并在 Sources 选项卡上显示生成的代码。