URL 암호화
페이지 정보
작성자 서방님 댓글 0건 조회 115회 작성일 06-09-12 12:51본문
<html>
<head>
<SCRIPT LANGUAGE="JavaScript">
<!--
function encryptIt() {
// the following letters are going to be encrypted.
var letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
var letterCode = new Array(
'%61','%62','%63','%64','%65','%66','%67','%68','%69','%6a',
'%6b','%6c','%6d','%6e','%6f','%70','%71','%72','%73','%74',
'%75','%76','%77','%78','%79','%7a',
'%41','%42','%43','%44','%45','%46','%47','%48','%49','%4a',
'%4b','%4c','%4d','%4e','%4f','%50','%51','%52','%53','%54',
'%55','%56','%57','%58','%59','%5a');
var _form = document.exf1;
var _formIn = _form.input.value.split(".");
var output = _formIn[0]+".";
for(var i = 0; i < _formIn[1].length; i++) {
if(letters.indexOf(_formIn[1].charAt(i))!=-1) {
if (letters.indexOf(_formIn[1].charAt(i))!=-1) {
// its a letter
var x = (Math.random()*1000)%10;
var j = letters.indexOf(_formIn[1].charAt(i));
if (x > 7) {
// j should be 0 through 25 for lowercase and 26 through 51 for uppercase
// switch them
if (j < 26) j += 26;
else j -= 26;
}
if (x < 3) { output += _formIn[1].charAt(i);
} else { output += letterCode[j]; }
} else { output += escape(_formIn[1].charAt(i)); }
} else { output += _formIn[1].charAt(i); }
}
for(var i=2;i<_formIn.length;i++)
output += "."+_formIn[i];
_form.output.value = output;
}
function testIt() {
var _l = document.exf1.output.value;
if (_l.indexOf("http://")==-1) _l = "http://"+_l;
var myWin = window.open(_l,"TestWin","width=500,height=500,location=yes");
}
// End -->
</script>
</head>
<body>
<form name=exf1>
암호화 버튼을 크릭하세요:
<BR>
<input type=text name=input size=50 value="www.naver.com">
<input type=button value="암호화" onclick="encryptIt()">
<BR>
암호화된 주소가 아래 나타납니다.
<BR>
<input type=text name=output size=50 value="">
<input type=button value="Test Encrypted URL" onclick="testIt()">
</form>
<p>
</body>
</html>
댓글목록
등록된 댓글이 없습니다.