Other webmasters feel free to use this, I find it pretty usefull.
Html Code encrypter & decrypter (works like a charm to protect sourcecode on whole page or some of it)
HTML Code:
<script language="JavaScript" type="text/javascript">
var ie=(document.all)?1:0;
var ns=(document.layers)?1:0;
var i=0;
function initStyleElements() {
var c = document.pad;
if (ie)
{
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;
}
function generate()
{
code = document.pad.text.value;
if (code)
{
document.pad.text.value=\\\\\\\\\\\'Compiling...\\\\\\\\\\\';
setTimeout("compile()",1000);
}
else alert(\\\\\\\\\\\'First enter something to compile and then press Compile It\\\\\\\\\\\')
}
function compile()
{
document.pad.text.value=\\\\\\\\\\\'\\\\\\\\\\\';
compilation=escape(code);
document.pad.text.value="<script>\n<!--\ndocument.write(unescape(\""+compilation+"\"));\n//-->\n<\/script>";
i++;
}
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> <p></p> <form name="pad" method="post" align="center"> <textarea style="WIDTH: 95%; BACKGROUND-COLOR: #ebebeb" name="text" rows="11" cols="58"> </textarea><br> <br> <input onclick="generate()" type="button" value="Encrypt" name="compileIt"> <input onclick="selectCode()"
type="button" value="Select" name="select"> <input onclick="preview()" type="button" value="Preview" name=
"view"> <input onclick="uncompile()" type="button" value="Source" name="retur"> <input
type="reset" value="Clear" name="clear"> </form>