()
| 24 | } |
| 25 | |
| 26 | function decrypt() { |
| 27 | var input = ""; |
| 28 | var input = document.getElementById("input").value; |
| 29 | |
| 30 | if (input.length == 0) { |
| 31 | generateWarning("Please enter a string "); |
| 32 | } |
| 33 | else { |
| 34 | var key = parseInt(document.getElementById("key").value); |
| 35 | if (key >= 999999999 || key <= -9999999999) { |
| 36 | generateWarning("Enter Proper key"); |
| 37 | } |
| 38 | var n_string = " "; |
| 39 | |
| 40 | for (k = 0; k < input.length; k++) { |
| 41 | |
| 42 | var x = input.charCodeAt(k) - key; |
| 43 | |
| 44 | n_string += String.fromCharCode(x); |
| 45 | |
| 46 | } |
| 47 | |
| 48 | document.getElementById("output").innerHTML = "<center><b><u>After Decryption :</u></b></center><br>" + n_string; |
| 49 | } |
| 50 | |
| 51 | } |
| 52 | function generateWarning(warningMessage) { |
| 53 | //To get the clicking sound |
| 54 | document.getElementById("click").play(); |
nothing calls this directly
no test coverage detected