Click here to Skip to main content
15,867,568 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i want this to work in html but the buttons wont click how do you even?


<html>
<script language="VBScript"> 
Sub Window_OnLoad
Dim width,height
width=700
height=500
self.ResizeTo width,height
End Sub
Function Validate(ID)
On Error Resume Next
Key = Int(pass.value)
If (pass.value = "") Then
X = MsgBox("You have to enter your password..!", 48, "Error")
Else If (tamsg.value = "") Then
X = MsgBox("Enter the text to encrypt or decrypt!", 48, "ERROR!")
Else
Junk = SetTimeOut(KEYS(ID), 1)
End If
End If
End Function
Function KEYS(ID)
text = pass.value
code = 0
Do Until text = ""
code = ((Asc(Left(text, 1)))+code)
text = Replace(text, Left(text, 1), "", "1", "1")
Loop
code = code Mod 420
akey.value = code
Junk = SetTimeOut(ID, 1)
End Function
Function Encrypt
Alpha = Array("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z")
text = tamsg.value
code = ""
key = Int(akey.value)
Do Until text = ""
cnum = Asc(Left(text, 1))
cnum = (cnum+key) Mod 420
num = cnum Mod 26
count = 0
tst = num
Do Until tst = cnum
tst = tst+26
count = count+1
Loop
code = code & Alpha(num) & count
text = Replace(text, Left(text, 1), "", "1", "1")
Loop
tamsg.value = code
End Function
Function Decrypt
Alpha = Array("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z")
text = tamsg.value
code = ""
key = Int(akey.value)
Do Until text = ""
lttr = Left(text, 2)
num = Asc(Left(lttr, 1))-65
chk = Right(lttr, 1)
count = 0
Do Until count = Int(chk)
num = num+26
count = count+1
Loop
num = num-key
Do While num <= 0
num = num+420
Loop
Code = code & Chr(num)
text = Replace(text, Left(text, 2), "", "1", "1")
Loop
tamsg.value = code
End Function
</script>

<input type="hidden" id="akey"> 

<table align="center" width="400">

<tr> <td align="center">

<textarea id="tamsg" cols="80" rows="15"></textarea>

<input type="password" id="pass"> 
 
<input type="button" Value="Encrypt" onClick="Validate('Encrypt')"Encrypt</span> 
 
<input type="button" Value="Decrypt" onClick="Validate('Decrypt')"Decrypt</span>
</html>


What I have tried:

editing the hell out of it but do not know how to go about this btw not my code im noob
Posted
Comments
AnvilRanger 7-Feb-18 2:58am    
What exactly are you attempting to do? Just pasting a code dump is not enough information for anyone to help, though I will give you points for formatting it correctly.

VB Script? Honestly I don't know where you got this code from, but VB Script for server side development has gone the way of the dinosaur and using it for client side development like you are attempting to do was never recommended even in the late 90's early 2000's because of one big problem, it only works in IE.
Member 13664778 7-Feb-18 3:21am    
lok man i already said im no expert, the buttons at the bottom of the source dont work if you had any advice even a php for it that would be much obliged the code works in hta but i need it to work in html or htm
F-ES Sitecore 7-Feb-18 4:33am    
Let's start with the basics. What browser are you using?
Member 13664778 7-Feb-18 4:47am    
hey mate ive tried chrome opera explorer firefox and safari but nothing gets these buttons to work
F-ES Sitecore 7-Feb-18 5:16am    
VBScript is only supported in IE, and even the latest IE has dropped support. You'll need to convert the code to javascript.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900