Statements

A statement is a syntactically complete unit that performs some task. It expresses one kind of action, declaration, or definition. The following statements are typical of a Visual Basic program or VBScript program:

If I = 10 Then      … End If 

The following conditional If...Then...Else statement is a common VBScript statement:

<%  If Time < #12:00:00 PM#  Then      greeting = "Good Morning!"  Else      greeting = "Hello!"  End If %> 

A user running this script before 12:00 noon by the Web server's system clock sees

Good Morning!

A user running the script at or after 12:00 noon sees

Hello!

This statement stores either the value "Good Morning!" or the value "Hello!" in the variable greeting. It does not send any values to the client browser.

The following lines send the value, displayed in green, to the client browser:

<FONT COLOR="GREEN">  <%= greeting %>  </FONT> 

You can include HTML text between the sections of a statement. For example, the following script produces the same result as the script in the previous section:

<FONT COLOR="GREEN"> <% If Time <#12:00:00 PM#  Then %>     Good Morning! <% Else %>     Hello! <% End If %>  </FONT> 

This script mixes HTML within an If...Then...Else statement. If the condition is True—that is, if the time is before noon—the Web server sends the HTML that follows the If condition ("Good Morning!") to the browser; otherwise, it sends the HTML that follows Else ("Hello!") to the browser.



Programming Microsoft Visual InterDev 6. 0
Programming Microsoft Visual InterDev 6.0
ISBN: 1572318147
EAN: 2147483647
Year: 2005
Pages: 143

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net