Aquí esta como lo soluciono
Código javascript
:
Ver original<?php
$link="http://www.google.com";
?>
<form name="ctrl">
<textarea name="iframe1"><iframe name="link" frameborder="0" width="100%" height="100%" src="<?php echo $link; ?>"></textarea>
<textarea name="iframe2"></textarea>
<input type="submit" value="Next" onClick="doencrypt(ctrl);">
</form>
<script language="JavaScript">
function doencrypt(theform) {
if (theform.iframe1.value == "") {
alert("No HTML code to encrypt");
return false;
} else {
enctext=encrypt(theform.iframe1.value);
EncCode="<Script Language='Javascript'>\n";
EncCode+="document.write(unescape('"+enctext+"'));\n";
EncCode+="</Script\>";
theform.iframe2.value=EncCode;
theform.sac.disabled = false;
} return false;
}
function sandc(thisform) {
thisform.iframe2.focus();
thisform.iframe2.select();
}
function encrypt(tx) {
var hex='';
var i;
for (i=0; i<tx.length; i++) {
hex += '%'+hexfromdec(tx.charCodeAt(i))
}
return hex;
}
function hexfromdec(num) {
if (num > 65535) {
return ("err!")
}
first = Math.round(num/4096 - .5);
temp1 = num - first * 4096;
second = Math.round(temp1/256 -.5);
temp2 = temp1 - second * 256;
third = Math.round(temp2/16 - .5);
fourth = temp2 - third * 16;
return (""+getletter(third)+getletter(fourth));
}
function getletter(num) {
if (num < 10) {
return num;
} else {
if (num == 10) {
return "A"
}
if (num == 11) {
return "B"
}
if (num == 12) {
return "C"
}
if (num == 13) {
return "D"
}
if (num == 14) {
return "E"
}
if (num == 15) {
return "F"
}
}
}
</script>