Friday, 6 September 2013

Write a VB Script to show this figure 3

Write a VB Script to show this figure:
1****
12***
123**
1234*
12345
Index.html
<html>
<head>
<title>
VBScript By Asif
</title>
<SCRIPT LANGUAGE="VBScript">
Sub asif
                Dim i,j,x,k
                Dim TheForm
                Set TheForm=Document.forms("Form1")
                If IsNumeric(TheForm.Text1.Value) Then
                                x=TheForm.Text1.Value
                                for i=1 to x
                                                for j=1 to i
                                                                document.write(j)
                                                next
                                                for k=x-1 to i Step -1
                                                                document.write("*")
                                                next
                                                document.write("<br/>")
                                Next
                Else
                                MsgBox "Wrong Input!"
                End If
End Sub
</SCRIPT>
</head>
<body>
<FORM NAME="Form1">
<input type="Text" name="Text1"><br/>
<INPUT TYPE="button" NAME="Button1" VALUE="View Figure"><br/>
<SCRIPT FOR="Button1" EVENT="onClick" LANGUAGE="VBScript">
                Call asif
</SCRIPT>
</FORM>
</body>
</html>
Output:

1****
12***
123**
1234*
12345

No comments:

Post a Comment