Wednesday, March 30, 2011

Inserting Client Side VBScript into an HTML Page


VBScript is added to an HTML page using the SCRIPT tag. The script tags should be placed inside the head tag of the document. They can appear anywhere in the document; but must be before the event that is going to trigger them. If an older browser looks at a page containing script tags it will ignore them, as older browsers are written to ignore tags they can't interpret.

VBScript code should also be placed inside an HTML Comment tag set.

E.g.  <!-- code -->

When used with VBScripts the ending comment tag will also start with two slashes REM which is the VBScript code for comment. This tells the VBScript interpreter to ignore that statement.
  
This is a standard way for adding VBScript to your HTML pages so that it works properly for browsers that are VBScript enabled and those that do not support VBScript.

<HTML> 
  <HEAD> 
  <TITLE>Web Page containing  VBScript</TITLE> 
  <SCRIPT  LANGUAGE="VBSCRIPT"> 
  <!-- hide VBScript code from  browsers that are not VBScript enabled 
  . 
  .(VBScript Statements goes here) 
  . 
  REM end hiding of VBScript code  --> 
  </SCRIPT> 
  </HEAD> 


        <BODY> 
        (HTML document goes here) 
        </BODY> 

</HTML>

We may also put in a single line of  code attached to an event. Events will be explained later. The general syntax for  this structure is:

<HTML_TAG  Attribute="option" onEvent="VBScript  code statements go 
  here">stuff in between the opening and closing tag</HTML_TAG>


No comments:

Post a Comment