当前位置:首页>>软件教程>>网页制作>>新闻内容
如何在网页中设置禁止查看源文件
作者: 发布时间:2006-3-1 12:09:49 文章来源:

  〈!--

  var i=0;

  var ie=(document.all)?1:0;

  var ns=(document.layers)?1:0;

  function initStyleElements() /* Styles for Buttons Init */

  {

  var c = document.pad;

  if (ie)

  {

  //c.text.style.backgroundColor="#DDDDDD";

  c.compileIt.style.backgroundColor="#C0C0A8";

  c.compileIt.style.cursor="hand";

  c.select.style.backgroundColor="#C0C0A8";

  c.select.style.cursor="hand";

  c.view.style.backgroundColor="#C0C0A8";

  c.view.style.cursor="hand";

  c.retur.style.backgroundColor="#C0C0A8";

  c.retur.style.cursor="hand";

  c.clear.style.backgroundColor="#C0C0A8";

  c.clear.style.cursor="hand";

  }

  else return;

  }

  /* Buttons Enlightment of "Compilation" panel */

  function LightOn(what)

  {

  if (ie) what.style.backgroundColor = ’#E0E0D0’;

  else return;

  }

  function FocusOn(what)

  {

  if (ie) what.style.backgroundColor = ’#EBEBEB’;

  else return;

  }

  function LightOut(what)

  {

  if (ie) what.style.backgroundColor = ’#C0C0A8’;

  else return;

  }

  function FocusOff(what)

  {

  if (ie) what.style.backgroundColor = ’#DDDDDD’;

  else return;

  }

  /* Buttons Enlightment of "Compilation" panel */

  function generate() /* Generation of "Compilation" */

  {

  code = document.pad.text.value;

  if (code)

  {

  document.pad.text.value=’Compiling...Please wait!’;

  setTimeout("compile()",1000);

  }

  else alert(’First enter something to compile and then press CompileIt’)

  }

  function compile() /* The "Compilation" */

  {

  document.pad.text.value=’’;

  compilation=escape(code);

  document.pad.text.value="〈script〉\n〈!--\ndocument.write(unescape(\""+compilation+"\"));\n//--〉\n〈\/script〉";


  i++;

  if (i=1) alert("Page compiled 1 time!");

  else alert("Page compiled "+i+" times!");

  }

  function selectCode() /* Selecting "Compilation" for Copying */

  {

  if(document.pad.text.value.length〉0)

  {

  document.pad.text.focus();

  document.pad.text.select();

  }

  else alert(’Nothing for be selected!’)

  }

  function preview() /* Preview for the "Compilation" */

  {

  if(document.pad.text.value.length〉0)

  {

  pr=window.open("","Preview","scrollbars=1,menubar=1,status=1,width=700,height=320,left=50,top=110");


  pr.document.write(document.pad.text.value);

  }

  else alert(’Nothing for be previewed!’)

  }

  function uncompile() /* Decompiling a "Compilation" */

  {

  if (document.pad.text.value.length〉0)

  {

  source=unescape(document.pad.text.value);

  document.pad.text.value=""+source+"";

  }

  else alert(’You need compiled code to uncompile it!’)

  }

  // --〉

  〈/SCRIPT〉

  〈BR〉〈B〉〈FONT color=#333333〉网页HTML源代码加密解密器〈/FONT〉〈/B〉〈/H2〉〈/DIV〉

  〈TABLE cellSpacing=0 borderColorDark=#000000 cellPadding=10 width=750

  align=center borderColorLight=#ffffff border=2〉

  〈TBODY〉

  〈TR〉

  〈TD〉

  〈DIV align=center〉〈BR〉将你的源代码贴到编辑区域即可〈BR〉〈BR〉

  〈TABLE cellSpacing=0 cellPadding=0 width="100%" border=0〉

  〈TBODY〉

  〈TR〉

  〈TD width="100%"〉〈!-- Compilation Panel --〉

  〈FORM name=pad method=post align="center"〉

  〈DIV align=center〉〈TEXTAREA style="WIDTH: 95%; BACKGROUND-COLOR: #ebebeb"
name=text rows=11 cols=58〉〈/TEXTAREA〉

  〈BR〉〈BR〉〈BR〉〈INPUT onmouseover=LightOn(this) onclick=generate() onmouseout=LightOut(this)
type=button value=加密 name=compileIt〉

  〈INPUT onmouseover=LightOn(this) onclick=selectCode() onmouseout=LightOut(this)
type=button value=全选 name=select〉

  〈INPUT onmouseover=LightOn(this) onclick=preview() onmouseout=LightOut(this)
type=button value=预览 name=view〉

  〈INPUT onmouseover=LightOn(this) onclick=uncompile() onmouseout=LightOut(this)
type=button value=解密 name=retur〉

  〈INPUT onmouseover=LightOn(this) onmouseout=LightOut(this) type=reset value=清除
name=clear〉

  〈/DIV〉〈/FORM〉〈!-- Compilation Panel --〉〈/TD〉〈/TR〉〈/TBODY〉〈/TABLE〉〈/DIV〉〈/TD〉〈/TR〉〈/TBODY〉〈/TABLE〉


  〈DIV align=center〉〈BR〉〈/DIV〉

  〈DIV align=center〉〈/DIV〉 〈/TD〉〈/TR〉〈/TBODY〉〈/TABLE〉

  〈/DIV〉

  〈DIV〉〈/DIV〉〈/BODY〉〈/HTML〉

 总结一下……按我的思路,屏蔽网页源代码主要分为以下几个步骤:

  1. 做一个网页跳板,弹出要保护的广告条状页面,并将自身关闭,以避免泄露需保护网页的地址。

  2. 由于上述条件屏蔽了广告条内网页的源代码,所以可以用这个网页作为欢迎页。

  3. 在欢迎页中,利用java script以超连接的形式来打开无窗口边的新窗口显示网站内容。

  4. 对每一个页面或者对重要的关键的页面进行源代码加密,为源代码加一把锁。(有些人说对源代码进行加密没有用,但是我觉得要使用另类点的加密方法就可以了,比如软件的加密方法就很普通。但是用我自己写的htm文件加密的源代码,一般软件是不能进行解密的。大家有兴趣的话可以试试。)

  5. 最后不得不提的就是windows网页临时文件夹了,那里面会把源代码纪录的。但是不用怕,加入一种代码,就可以使windows不下载网页的源代码,直接浏览。可以去找找。

  有些东西要注意的:

  1. 在文中所说的自动关闭网页的语句:window.close()有一个弊病。就是会在关闭窗口之前询问是否关闭窗口,如果选择否的话目的还是达不到。

  2. 以上一切都只对IE浏览器有效用,如果用别的浏览器来浏览,就有可能出现屏蔽不成功的现象。

  3. 关于网页源代码屏蔽,一直以来是可望而不可及的。我只是把思路写下来,具体实现,还是要靠大家自己研究的啦。


[首页]    [上一页]    [下一页]    [末页]    
最新更新
·如何去掉ECShop2.7中的Powered by ECSh
·在IE7下生成高质量CSS缩略图
·解决Dreamweaver打开和关闭时出现JavaS
·影响搜索引擎排名的因素2009版
·IE6/IE7/IE8/Firefox/Chrome/Safari的C
·Flash对联广告及关闭按钮制作方法
·Discuz! 7中如果设置帖子中显示图片而不
·5种方法立刻写出更好的CSS代码
·兼容IE和Firefox的按图片宽度缩放的CSS
·兼容Firefox和IE浏览器的“加入收藏”代
相关信息
·一个网页游戏商的“非典型套现”
·常用长度单位PX/EM/PT/百分比转换公式与对照表
·制作网站网页的四十个建议和技巧
·什么是无障碍网页设计?规范和检测要点
·去除网页文字干扰码的两种方法
·巧妙去除网页中文字干扰码的两种方法
·用图片实现超级链接的个性化下划线
·浅析HTML和XHTML的区别
·maquee无缝滚动向上向下向左向右的代码
·符合标准的正常工作的一种对联广告
画心
愚爱
偏爱
火苗
白狐
画沙
犯错
歌曲
传奇
稻香
小酒窝
狮子座
小情歌
全是爱
棉花糖
海豚音
我相信
甩葱歌
这叫爱
shero
走天涯
琉璃月
Nobody
我爱他
套马杆
爱是你我
最后一次
少女时代
灰色头像
断桥残雪
美了美了
狼的诱惑
我很快乐
星月神话
心痛2009
爱丫爱丫
半城烟沙
旗开得胜
郎的诱惑
爱情买卖
2010等你来
我叫小沈阳
i miss you
姑娘我爱你
我们都一样
其实很寂寞
我爱雨夜花
变心的玫瑰
犀利哥之歌
你是我的眼
你是我的OK绷
贝多芬的悲伤
哥只是个传说
丢了幸福的猪
找个人来爱我
要嫁就嫁灰太狼
如果这就是爱情
我们没有在一起
寂寞在唱什么歌
斯琴高丽的伤心
别在我离开之前离开
不是因为寂寞才想你
爱上你等于爱上了错
在心里从此永远有个你
一个人的寂寞两个人的错