當前位置:編程學習大全網 - 源碼下載 - 怎樣把網頁的代碼,不讓別人在查看中的源代碼中隨便看啊?需要加上哪些代碼

怎樣把網頁的代碼,不讓別人在查看中的源代碼中隨便看啊?需要加上哪些代碼

1:網頁加密代碼

<script language=JavaScript>

<!--

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('請先把需待加密的代碼copy到此框中')

}

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("代碼已編譯1次!");

else alert("代碼已編譯"+i+"次!");

}

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

{

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

{

document.pad.text.focus();

document.pad.text.select();

}

else alert('無任何內容被選中!')

}

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('無任何內容可供預覽!')

}

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('請把需待還原的代碼copy到此框中!')

}

// -->

</script>

<table border=0 cellpadding=0 cellspacing=0 width="100%">

<tbody>

<tr>

<td width="100%">

<form method=post name=pad align="center">

<div align="center">

<textarea cols=58 name=textarea rows=11 style="BACKGROUND-COLOR: #ebebeb; WIDTH: 95%">

2網頁保密代碼

第壹步:把如下代碼加入到<head>區域中

<SCRIPT language=javascript>

<!--

var Words;

function SetWords(word)

{

Words = escape(word.value);

}

function SetNewWords(form)

{

var NewWords;

NewWords = Words

form.NewWords.value = NewWords;

}

//-->

</SCRIPT>

第二步:把如下代碼加入到<body>區域中

<br>

<center>

<table border=5 bordercolor=#000000 borderlight=green>

<tr>

<td align=center width="500"><font size=5 color=red face="Arial, Helvetica, sans-serif"></font></td>

</tr>

<tr>

<td align=center width=500 height=50>

<FORM METHOD="POST">

<div align="center">

<div align="center"> <font color="#999999"><b><font face="楷體_GB2312" size="3">加密頁面源代碼腳本</font></b></font></div>

<p>將妳的頁面源代碼粘貼在下面的框內,要包括所有的標簽例如html , head, body等。</p>

</div>

<P align="center">

<TEXTAREA NAME="Word" VALUE="" ROWS=7 COLS=50 ONCHANGE="SetWords(this)">

下面給幾種參考方法,使在瀏覽我的個人主頁時不能使用右鍵或者不能看到源程序或源代碼等。

1)在主頁上輸入代碼:

<SCRIPT language=javascript>

function click() {

if (event.button==2) {

alert('對不起,禁止使用此功能^_^.')

}

}

document.onmousedown=click

</SCRIPT>

<script language="javascript">

<!--

locate = 0;

function scroller() {

if (locate !=500 ) {

locate++;

scroll(0,locate);

clearTimeout(timer);

var timer = setTimeout("scroller()",3);

timer;

}

}

// -->

</script>

  • 上一篇:Php購物車checkout:下面怎麽寫check out()方法,最好解釋壹下,然後最好在下面的伊卡特類中解釋壹下check()方法。
  • 下一篇:壓力測試的測試案例
  • copyright 2024編程學習大全網