By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,071 Members | 1,244 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,071 IT Pros & Developers. It's quick & easy.

Convert Javascript to VBscript

P: 54
Hi,

i have a javascript code. I want to convert into VBscript.

pls
help me

Javascript Code:

Expand|Select|Wrap|Line Numbers
  1. <!-- TWO STEPS TO INSTALL VIRGENERE ENCRYPTION:
  2.  
  3.   1.  Copy the coding into the HEAD of your HTML document
  4.   2.  Add the last code into the BODY of your HTML document  -->
  5.  
  6. <!-- STEP ONE: Paste this code into the HEAD of your HTML document  -->
  7.  
  8. <HEAD>
  9.  
  10. <SCRIPT LANGUAGE="JavaScript">
  11. <!-- Original:  Francisco Ryan Tolmasky (iopossum@mailcity.com) -->
  12. <!-- Web Site:  http://iopossum.tripod.com -->
  13.  
  14. <!-- This script and many more are available free online at -->
  15. <!-- The JavaScript Source!! JavaScript Source: Free JavaScripts, Tutorials, Example Code, Reference, Resources, and Help -->
  16.  
  17. <!-- Begin
  18. var TID = 0;
  19. var longer = 0;
  20. var thirdwrite = "";
  21. var alphabet = new Array("0@","1#","2$","3%","4^","5&","6*","7 = ","8-","9+","Aa","Bb","Cc","Dd","Ee","Ff","Gg","Hh","Ii","Jj","Kk","Ll","Mm","Nn","Oo","Pp","Qq","Rr","Ss","Tt","Uu","Vv","Ww","Xx","Yy","Zz");
  22. function preTime(coco, uinput, question) {
  23. longer = coco.length - 1;
  24. placement = 0;
  25. ref = 0 ;
  26. secondWrite = "";
  27. firstWrite = "";
  28. thirdWrite = "";
  29. code1(coco, uinput, longer, question);
  30. }
  31. function findshift(letter) {
  32. for (i = 0; i < 36; i++) {
  33. if ((alphabet[i].substring(0,1) == letter) || (alphabet[i].substring(1,2) == letter)) {
  34. if (alphabet[i].substring(0,1) == letter) {
  35. x = 0;
  36. }
  37. if (alphabet[i].substring(1,2) == letter) {
  38. x = 1;
  39. }
  40. return i;
  41.       }
  42.    }
  43. }
  44. function check(letter) {
  45. bill = "no";
  46. for (i = 0; i < 36; i++) {
  47. if ((alphabet[i].substring(0,1) == letter) || (alphabet[i].substring(1,2) == letter)) {
  48. bill = "yes";
  49.    }
  50. }
  51. if (bill == "yes") {
  52. return true;
  53. }
  54. else {
  55. return false;
  56.    }
  57. }
  58. function fixoffset(takin) {
  59. if (takin > 35) {
  60. return (takin - 36);
  61. }
  62. else {
  63. return takin;
  64.    }
  65. }
  66. function code1(inval1,inval2,inval3,sage) {
  67. if (check(inval2.charAt(placement))) {
  68. if (check(inval1.charAt(ref))) {
  69. if (sage == 0) { 
  70. shift = findshift(inval1.charAt(ref));
  71. }
  72. if (sage == 1) { 
  73. shift = 36 - findshift(inval1.charAt(ref));
  74.    }
  75. }
  76. else {
  77. shift = 0;
  78. }
  79. orig = findshift(inval2.charAt(placement));
  80. firstWrite = firstWrite+alphabet[fixoffset(orig+shift)].charAt(x);
  81. }
  82. else {
  83. firstWrite = firstWrite+inval2.charAt(placement);
  84. }
  85. secondWrite = inval2.substring(placement+1,inval2.length+1);
  86. thirdWrite = firstWrite+secondWrite;
  87. document.inputo.written.value = thirdWrite;
  88. placement++;
  89. if (ref == inval3) {
  90. ref = 0
  91. }
  92. else {
  93. ref++;
  94. }
  95. if (placement == (inval2.length)) {
  96. window.clearTimeout(TID);
  97. return false;
  98. }
  99. one = inval1;
  100. two = inval2;
  101. three = inval3;
  102. goer = sage;
  103. TID = window.setTimeout("code1(one, two, three, goer)", 0);
  104. }
  105. //  End -->
  106. </script>
  107. </HEAD>
  108.  
  109. <!-- STEP TWO: Copy this code into the BODY of your HTML document  -->
  110.  
  111. <BODY>
  112.  
  113. <center>
  114. <form name="inputo">
  115. <textarea name=written rows=12 cols=40>Type message to encode here</textarea>
  116. <br>
  117. Code Phrase:<input type=text name=codeWord value="code phrase here">
  118. <input type=button value="Encode" onClick="preTime(codeWord.value,written.value, 0);">
  119. <input type=button value="Decode" onClick="preTime(codeWord.value,written.value, 1);">
  120. </form>
  121. </center>
  122.  
  123. <p><center>
  124. <font face="arial, helvetica" size="-2">Free JavaScripts provided<br>
  125. by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
  126. </center><p>
  127.  
Thanks,
Murugavel
Jan 17 '09 #1
Share this Question
Share on Google+
2 Replies


gits
Expert Mod 5K+
P: 5,352
what help do you need exactly? just have a look at the code you posted and rewrite it in vb. in case you have specific problems with the JavaScpript code, then post back here so that we could explain the JavaScript-statements that you want to have explained ... but certainly noone will just rewrite that script for you.

kind regards
Jan 17 '09 #2

acoder
Expert Mod 15k+
P: 16,027
Hmm... why would you even want to convert from JavaScript to VBScript? JavaScript works in more or less all browsers while VBscript is limited to a single browser. Now I could understand if the request was the other way round, i.e. from VBScript to JavaScript.
Jan 18 '09 #3

Post your reply

Sign in to post your reply or Sign up for a free account.