下面这段JS代码是网址解密的代码
<script>
function uncompile(code){
code=unescape(code);
var c=String.fromCharCode(code.charCodeAt(0)-code.length);
for(var i=1;i <code.length;i++) c+=String.fromCharCode(code.charCodeAt(i)-c.charCodeAt(i-1));
return c;
}
document.write(uncompile(""));
</script>请高手帮忙把它改成加密的,小弟是菜鸟,麻烦各位大哥直接给代码好吗??谢谢了
<script>
function uncompile(code){
code=unescape(code);
var c=String.fromCharCode(code.charCodeAt(0)-code.length);
for(var i=1;i <code.length;i++) c+=String.fromCharCode(code.charCodeAt(i)-c.charCodeAt(i-1));
return c;
}
document.write(uncompile(""));
</script>请高手帮忙把它改成加密的,小弟是菜鸟,麻烦各位大哥直接给代码好吗??谢谢了
function uncompile(code){
code=unescape(code);
var c=String.fromCharCode(code.charCodeAt(0)-code.length);
for(var i=1;i <code.length;i++) c+=String.fromCharCode(code.charCodeAt(i)-c.charCodeAt(i-1));
return c;
} function compile(code)
{
var c=String.fromCharCode(code.charCodeAt(0)+code.length);
for(var i=1;i<code.length;i++){
c+=String.fromCharCode(code.charCodeAt(i)+code.charCodeAt(i-1));
}
return escape(c);
}
alert(uncompile(compile("abcd")))
function compile(code)
{
var c=String.fromCharCode(code.charCodeAt(0)+code.length);
for(var i=1;i<code.length;i++){
c+=String.fromCharCode(code.charCodeAt(i)+code.charCodeAt(i-1));
}
return escape(c);
}
alert(uncompile(compile("abcd")))
</script>
谢谢楼上的大哥了,可是不行啊,我把它存为.html打开后空白,请问你是不是哪里搞错了?
function compile(code)
{
var c=String.fromCharCode(code.charCodeAt(0)+code.length);
for(var i=1;i<code.length;i++){
c+=String.fromCharCode(code.charCodeAt(i)+code.charCodeAt(i-1));
}
return escape(c);
}
alert(uncompile(compile("http://www.xxx.com/111.rm")))
</script> 用IE打开空白,没有显示加密后的内容
<script>
function uncompile(code){
code=unescape(code);
var c=String.fromCharCode(code.charCodeAt(0)-code.length);
for(var i=1;i <code.length;i++) c+=String.fromCharCode(code.charCodeAt(i)-c.charCodeAt(i-1));
return c;
} function compile(code)
{
var c=String.fromCharCode(code.charCodeAt(0)+code.length);
for(var i=1;i<code.length;i++){
c+=String.fromCharCode(code.charCodeAt(i)+code.charCodeAt(i-1));
}
return escape(c);
}alert(uncompile(compile("http://www.xxx.com/111.rm")))
</script>
alert(uncompile(compile("http://www.xxx.com/111.rm")))
是线编码后解码。
---------------
分开来用 这么写:<script>
function uncompile(code){
code=unescape(code);
var c=String.fromCharCode(code.charCodeAt(0)-code.length);
for(var i=1;i <code.length;i++) c+=String.fromCharCode(code.charCodeAt(i)-c.charCodeAt(i-1));
return c;
} function compile(code)
{
var c=String.fromCharCode(code.charCodeAt(0)+code.length);
for(var i=1;i<code.length;i++){
c+=String.fromCharCode(code.charCodeAt(i)+code.charCodeAt(i-1));
}
return escape(c);
}var codeded = compile("http://www.xxx.com/111.rm");
alert("编码后:" + codeded)
var decoded = uncompile(codeded);
alert("解码后:" + decoded);</script>