VB Script Part 1

Made By
Arsalan Aslam

Because of the stupid Geocities Ad the script was giving error.
So I have not placed the VBScript here.

Please note that I'm not sure whether VBScript works with Netscape Browser (mainly JavaScript is used for Netscape), but I'm sure that it works with Internet Explorer

The code for this is given below. (HTML is in blue, VBScript is in Black and comment is in green)
Just copy and paste the following into notepad and save it as index.htm (just copy the whole thing it will not give problem as comment which is in green is a real comment of VBScript)


<HTML>
<HEAD>
<TITLE>Simple VB Script (By Code Master)</TITLE>

<SCRIPT LANGUAGE=vbscript>
Sub button1_onclick
dim name
' Declare the variable to store the name
'Show the inputbox and store the returned value
'to the name
name=inputbox ("Please enter your name")
'Then set the value of the text1 to name
text1.value=name
End Sub
</SCRIPT>

</HEAD>
<BODY>

<P align=center><INPUT id=text1 style="WIDTH: 218px; HEIGHT: 22px" size=31
name=text1><BR><INPUT id=button1 type=button value="Display Dialog" name=button1></P>

</BODY>
</HTML>


Whatever is inside the tag SCRIPT is a script. LANGUAGE specifies which script you are using VBScript or JScript. In this case we are using VBScript.
Then there is a sub named button1_onclick
I hope you know what sub is. (if not see Script Part 1)

This event is executed whenever a button named button1 is clicked. The name is specified in the HTML as
<INPUT id=button1 type=button value="Display Dialog" name=button1>
for button
<INPUT id=text1 style="WIDTH: 218px; HEIGHT: 22px" size=31 name=text1> for text

InputBox is general function in VB and also VBScript which shows input box with the specified text. This function returns the text typed by the user
Then we set the value of text1 to name variable.

I hope you've understand this tutorial

For comment or feedback mail me

Back To Previous Page

Hosted by www.Geocities.ws

ge" width="150" height="30">

Hosted by www.Geocities.ws


Then we set the value of text1 to name variable.

I hope you've understand this tutorial

For comment or feedback mail me

Back To Previous Page

Hosted by www.Geocities.ws

1