View Full Version : Using Javascript in URLS

01-21-2010, 07:45 PM

I got a script to encrypt and decrypt the strings from php to javascript it works fine and return a perfect result.
my problem is that when i do document.write the function decode the string and write the proper url but when i put the same function as source of file the file does not display.

Please have a look at the function and help!

<script type="text/javascript" src="dessrc.js"></script>
<script type="text/javascript" src="desextra.js"></script>
<script type="text/javascript">
var message = "0x401cf90c847df8967e99ee29fd56d8de";
function RunDes(f,encrypt,key,message) { //run all the different types of Des
//All the conditions are to to try to stop a Javascript error with vector being null
var vector = null;
//get the message
if (!encrypt) message = hexToString (message); //treat it as hex
var result = des (key, message, encrypt, vector ? 1 : 0, vector);
if (encrypt) result = stringToHex (result); //output as hex
return result; //put the result into the form


<script type="text/javascript">
document.write(RunDes(this.form,0,key,message)); //prints images/love.jpg

Not working in Following Image the same url
<img src="javascript:RunDes(this.form,0,key,message);" />