您现在的位置是:首页 > 电脑技术查询 > web开发

【初学者提问】这段代码如何改才能让document.write的内容显示在当前页?

编辑:chaxungu时间:2022-10-02 23:16:53分类:web开发

【菜鸟提问】这段代码怎么改才能让document.write的内容显示在当前页??
HTML code<html> <head> <title>123</title> <script type="text/javascript"> function addem(){ document.write("123123"); } </script> </head> <body bgcolor="red"> <a href="javascript:addem()">click here</a> <h2>hello</h2> </body></html>
1 这段代码怎么改才能让document.write的内容显示在当前页?
2 还有一个问题,用firefox的时候点击链接,结果显示出来了,但是页面一直载入是怎么回事呢?一下午了也没弄明白。

------解决方案--------------------
document.write会清空当前页面再输出的