解决方法
来源将显示页面加载的源(由服务器提供).
生成的源代码将从当前DOM元素中绘制“源代码”,因此包含由JavaScript动态创建的元素.
例如,源将显示:
<script> window.onload = function(){ document.getElementById('test').innerHTML = 'Generated Content'; } </script> <html> <div id='test'>Source</div> </html>
并且生成的源将在您单击“查看生成的源”时“绘制”源,之后div的内容已更改,您将看到:
<script> window.onload = function(){ document.getElementById('test').innerHTML = 'Generated Content'; } </script> <html> <div id='test'>Generated Content</div> <!-- Note the difference here --> </html>