返回信息流附件有网页源代码!!
<script>
window.onload =function(){
//将网页的HTML内容保存在str中
var str =document.documentElement.outerHTML;
document.open();//将页面内容清空
document.write("这是能看见的网页代码");
document.close();
//书里说,将变量str的内容赋值到document.body.innerHTML
//此步骤不会影响到代码中的内容,对这里不理解
//这样不会将 document.write("这是能看见的网页代码");
//所做的改变覆盖掉吗?
document.body.innerHTML =str;
}
</script>
=======================================================================
以下是完整的源代码:
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=GB2312" />
<title>12-3 源代码的简单隐藏</title>
<script>
window.onload = function(){
var str;
str = document.documentElement.outerHTML;
document.open();
document.write("<!-- 你能看到真正的源代码吗? -->");
document.close();
document.body.innerHTML = str;
}
</script>
</head>
<body style="overflow:auto; padding:0px; margin:0px;">
<div style="font-size:14px; font-weight:bold; color:white; font-family:Arial, 宋体; background-color:#6090DA; padding:4px 10px;">
你好
<script>
dt = new Date();
document.write(",当前时间是 ");
document.write(dt.toLocaleTimeString());
</script>
</div>
</body>
</html>
附件(757B)
这是一条镜像帖。来源:北邮人论坛 / www-technology / #11789同步于 2010/12/4
该镜像源已超过 30 天没有更新,可能在源站已被删除。
WWWTechnology机器人发帖
求教关于 一个网页隐藏代码的问题
isbyr
2010/12/4镜像同步3 回复
订阅后,新回复会通过你的通知中心匿名送达。
3 条回复
【 在 isbyr 的大作中提到: 】
: 附件有网页源代码!!
: <script>
: window.onload =function(){
: ...................
upup
我猜是因为注释不属于document.body.innerHTML
页面隐藏代码?这都是浮云。。
显示页面源代码是没有js处理过的源代码,firebug,chrome审查元素能看到处理过的源代码,要什么有什么。实在没有,打开word,全选粘贴,转换成html,也能保持大部分格式
反正都是被你看到了的东西了,有什么隐藏不隐藏的