Hi Guys, first time using javascript and i need wee bit of help. I am developing a simple encypyt decrypt script, and I am using charCodeAt() to assign each char a number, i have got this far but now I need to cube that number and put it in a new array, how do i do this:
thanks in advance
<html>
<body>
<script type=”text/javascript”>
var e = “no data”;
function encrypt(form){
if(form.input.value ==””) alert(e);
else {var plaintext = form.input.value.split(” “);
for(i = 0; i < plaintext.length; i++){
document.write(“<br /> Element ” + i + ” = ” + plaintext[i]);
document.write(plaintext[i].charCodeAt(0)); //need to cube (plaintext[i].charCodeAt(0) and output to new array
}
}
}
</script>
<center>
<form name=encryptform>
<table>
<tr>
<td align=center>Original String</td>
<td> </td>
<td align=center>Encrypted Code</td>
</tr>
<tr>
<td align=center><input name=input type=text size=40></td>
<td align=center>
<input type=button value=”Decrypt” onClick=”javascript:decrypt(this.form)”><br>
<input type=button value=”Encrypt” onClick=”javascript:encrypt(this.form)”>
</td>
<td align=center><input name=output type=text size=40></td>
</tr>
</table>
</form>
</center>
</body>
</html>