document.write怎么返回上之前的页面
答案:1 悬赏:0
解决时间 2021-01-04 07:52
- 提问者网友:生亦何欢
- 2021-01-03 13:43
用doucment.write把JSON生成一个table之后覆盖了原画面,有没有办法返回执行document.write之前原有的页面的办法
最佳答案
- 二级知识专家网友:蜜罐小熊
- 2021-01-03 15:21
假设你用document.write是这样写的
document.write(str);
那么你可以改写成
document.body.innerHTML+=str;
这样就会在原来的网页的后面做出输出
下面是我的测试代码
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script>
function writeit()
{
document.body.innerHTML+="fuck me behind";
}
</script>
</head>
<body>
<a href="javascript:writeit();">write</a>
</body>
</html>
document.write(str);
那么你可以改写成
document.body.innerHTML+=str;
这样就会在原来的网页的后面做出输出
下面是我的测试代码
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script>
function writeit()
{
document.body.innerHTML+="fuck me behind";
}
</script>
</head>
<body>
<a href="javascript:writeit();">write</a>
</body>
</html>
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯