|
||
Lesson 8
Objective
|
Response.Write
Write ASP variables, text and HTML code to send to a browser. |
|
|
When a Web server sends data to a browser, it is sent as a series of data bytes.
Concatenating Strings
Response.Write() lets you insert values from ASP scripts (as HTTP code) as they are created. So far, we have seen examples of writing:
Concatenation is the process of merging two strings into one. In VBScript, the concatenation operator is the ampersand
(&).
Here are examples of how concatenation works and how it can be used with Response.Write: strResult = "Hello, " & "World" strFirst = "Hello," strSecond = "World" strResult = strFirst & strSecond
would result in strResult also containing the value "Hello, World"
Writing HTML tags with Response.Write()
<% Response.Write(strFirst & strSecond)%> would cause "Hello World" to be displayed on the user's browser. In the above examples, both of the expressions are of the String subtype. Whenever an expression used in this way is not a string, ASP will convert it to a String subtype.
<% Response.Write("<TABLE WIDTH='100%'>") %>
In standard HTML the sequence for the table width (<TABLE WIDTH=90%>) includes the characters
%>.
Since those characters are used by ASP as an ending delimiter, we can't use them directly, but must signal the interpreter using a back slash (\), like this:
<% Response.Write("<TABLE WIDTH=90%\>") %>
The next lesson describes the three parts of ASP technology. |
||
|
|
||


