Friday, 13 September 2013

Write a VB Script program to accept four digit numbers and display the reverse of it


Index.html
------------------
<html>
<head>
<title>VB Script By Asif</title>
<script language="VBScript">
Sub asif
Dim a,rev,i
Dim TheForm
Set TheForm=Document.forms("Form1")
If IsNumeric(TheForm.Text1.Value) Then
a=TheForm.Text1.Value
l = Len(a)
For i = 1 to l
rev = Mid(a,i,1) & rev
Next
document.write(rev)
Else
MsgBox "Wrong Input!"
End If
End Sub
</Script>
</head>
<body>
<form name="Form1">
Number1:<input type="text" name="Text1"/><br/>
<input type="button" name="Button1" value="ADD"/>
<script for="Button1" event="onClick" language="VBScript">
Call asif
</script>
</form>

</body>
</html>
Input:
------------
1234
Output:
-----------
4321

No comments:

Post a Comment