如何查看document.write()的结果? [英] How to view results of document.write()?

查看:95
本文介绍了如何查看document.write()的结果?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个我正在尝试调试的脚本,它使用document.write()

将HTML放在页面中。在IE6和Firefox中,当我查看

源代码时,我只看到脚本本身而不是任何HTML,因为它是写入页面的




有没有办法可以查看页面中的内容,

而不是javascript代码?

I''ve got a script that I''m trying to debug which uses document.write()
to place HTML within a page. In both IE6 and Firefox when I view
source, I see only the script itself and not any HTML as it''s being
written into the page.

Is there a way that I can view what is being placed into the page,
instead of, or in addition to the javascript code?

推荐答案



" Eli" < u1@zolx.com>在消息中写道

新闻:g7 ******************************** @ 4ax.com ...

"Eli" <u1@zolx.com> wrote in message
news:g7********************************@4ax.com...
我有一个我正在尝试调试的脚本,它使用document.write()
将HTML放在页面中。在IE6和Firefox中,当我查看源代码时,我只看到脚本本身,而不是任何HTML,因为它被写入页面。

是否有我可以查看页面中的内容,而不是javascript代码,或者除了javascript代码之外还有什么内容?
I''ve got a script that I''m trying to debug which uses document.write()
to place HTML within a page. In both IE6 and Firefox when I view
source, I see only the script itself and not any HTML as it''s being
written into the page.

Is there a way that I can view what is being placed into the page,
instead of, or in addition to the javascript code?




调用页面中的页面浏览器。

就是这样写的。


---

外发邮件已经过无病毒认证。

由AVG反病毒系统检查( http://www.grisoft.com)

版本:6.0.788 /病毒数据库:533 - 发布日期:2004年11月1日



call up the page in the browser.
that is what it writes.

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.788 / Virus Database: 533 - Release Date: 11/1/2004


Hal Rosser写道:
Hal Rosser wrote:
" Eli" < u1@zolx.com>在消息中写道
新闻:g7 ******************************** @ 4ax.com ...
"Eli" <u1@zolx.com> wrote in message
news:g7********************************@4ax.com...
我有一个我正在尝试调试的脚本,它使用document.write()
将HTML放在页面中。在IE6和Firefox中,当我查看源代码时,我只看到脚本本身,而不是任何HTML,因为它被写入页面。

是否有我可以查看页面中的内容,而不是javascript代码,或者除了javascript代码之外还有什么内容?
I''ve got a script that I''m trying to debug which uses document.write()
to place HTML within a page. In both IE6 and Firefox when I view
source, I see only the script itself and not any HTML as it''s being
written into the page.

Is there a way that I can view what is being placed into the page,
instead of, or in addition to the javascript code?



在浏览器中调用页面。这就是它写的东西。


call up the page in the browser.
that is what it writes.




你真的测试过你的答案吗?


到OP:

最简单的方法是在页面上添加一个textarea,而不是

document.write(或者除此之外),将textarea的值设置为

变量。


-

兰迪

comp.lang.javascript常见问题 - http://jibbering.com/faq


2004年11月10日星期三01:17:38 -0500,Randy Webb

< Hi ************ @ aol.com>写道:
On Wed, 10 Nov 2004 01:17:38 -0500, Randy Webb
<Hi************@aol.com> wrote:
Hal Rosser写道:
Hal Rosser wrote:
" Eli" < u1@zolx.com>在消息中写道
新闻:g7 ******************************** @ 4ax.com ...
"Eli" <u1@zolx.com> wrote in message
news:g7********************************@4ax.com...
我有一个我正在尝试调试的脚本,它使用document.write()
将HTML放在页面中。在IE6和Firefox中,当我查看源代码时,我只看到脚本本身,而不是任何HTML,因为它被写入页面。

是否有我可以查看页面中的内容,而不是javascript代码,或者除了javascript代码之外还有什么内容?
I''ve got a script that I''m trying to debug which uses document.write()
to place HTML within a page. In both IE6 and Firefox when I view
source, I see only the script itself and not any HTML as it''s being
written into the page.

Is there a way that I can view what is being placed into the page,
instead of, or in addition to the javascript code?



在浏览器中调用页面。这就是它写的东西。


call up the page in the browser.
that is what it writes.



你有没有真正测试过你的答案?

OP:
最简单的方法是在页面中添加一个textarea,而不是
document.write(或者除此之外),将textarea的值设置为
变量。



Do you ever actually test what you answer?

To the OP:
The simplest way is to add a textarea to the page, instead of
document.write (or in addition to), set the textarea''s value to your
variable.




谢谢。因为它代码不做单个document.write()

变量,但在条件,循环等中写入很多。


我想它可以这样重写,但是,如果这是最好的方式。



Thank you. As it stands the code doesn''t do a single document.write()
of a variable, but numerous writes in conditionals, loops, etc.

I suppose it could be rewritten as such, however, if this is the best
way.


这篇关于如何查看document.write()的结果?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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