JavaScript 怎么看解析后的源代码?

比如我写了个脚本:

<script>
var a='<div style="background-color:red;height:100px;width:100px"></div>';
document.write(a);
</script>

要是在网页看源代码的话,也是:

<script>
var a='<div style="background-color:red;height:100px;width:100px"></div>';
document.write(a);
</script>

怎么才能看到:

<div style="background-color:red;height:100px;width:100px"></div>

就是JavaScript运算完后的html代码?

阅读 2.9k
3 个回答

网页上右键“审元素”(chrome)/"查看元素"(firefox)

把内容写入到一个div中试试。

浏览器 查看dom

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题