COMPUTER LANGUAGES HTML,C,C++.JAVA,.NET AND MULTIMEDIA basics and programs click home button
VB SCRIPT PLACEMENT IN HTML FILE
VBScript Placement in HTML File
There is a flexibility given to include VBScript code anywhere in
an HTML document. But the most preferred way to include VBScript in your HTML file is as follows:
• Script in <head>...</head> section.
• Script in <body>...</body> section.
• Script in <body>...</body> and <head>...</head> sections.
• Script in an external file and then include in <head>...</head> section.
In the following section, we will see how we can put VBScript in different ways:
VBScript in <head>...</head> section
If you want to have a script run on some event, such as when a user
clicks somewhere, then you will place that script in the head as follows:
<html>
<head>
<script type="text/Vbscript">
<!--
Function sayHello()
Msgbox("Hello World")
End Function
//-->
</script>
</head>
<body>
<input type="button" onclick="sayHello()" value="Say Hello" />
</body>
</html>
It will produce the following result: A button with the name SayHello.
Upon clicking on the Button, the message box is displayed to the user
with the message "Hello World".
No comments:
Post a Comment