|
This is part 2 of 6 of ASP 101 by AaronOutpost.com. If you are unsure of what we
may be talking about in the tutorial, view the previous parts.
So far we have created your first ASP page and we
have defined a value and displayed it on the page. We are now going to take that
exact same page and modify it. I am going to show you how to mix ASP with HTML.
Let's begin.
Part 2:
Mix ASP with HTML
START YOUR PAGES
Open your favorite text or HTML
editor. It can be FrontPage, NotePad, FireWorks, Arachnophilia, etc... It
don't matter.
Open
first_asp_page_part1.asp, the file we created in the previous tutorial. Your
code should look like this.
|
<html>
<head>
<title>My
First ASP Page</title>
</head>
<body
bgcolor="#FFFFFF" text="#000000"
link="#003300" vlink="#006600"
alink="#689577">
<%
'Dimension
variables
Dim
MyVariable 'Comment on what this variable holds
'Write
line breaks into the web page
Response.Write ("<br><br>")
'Start a font tag
and use double quotes
Response.Write ("<font face=""Arial"" size=""2"" color=""#000000"">")
'Write
MyVariable to the web page
Response.Write (MyVariable)
'End a font tag
Response.Write ("</font>")
'Close the server script %>
</body>
</html> |
HOW TO MIX ASP WITH HTML
You will notice that you can end the
ASP script %> and go back to HTML. You can actually
do this and still keep your stored variables.
Also, in the middle of html code you
can enter ASP. Say you are in the middle of html code and you want to enter your
value. Simply open ASP script, put and equals sign and then the variable. Of
course end the asp script to return back to HTML.
Now knowing this, let's change our existing page to
use more html and not the response.write function.
|
<html>
<head>
<title>My
First ASP Page</title>
</head>
<body
bgcolor="#FFFFFF" text="#000000"
link="#003300" vlink="#006600"
alink="#689577">
<%
'Dimension
variables
Dim
MyVariable 'Comment on what this variable holds
<br><br>
<font face="Arial" size="2" color="#000000"><%= MyVariable
%></font>
</body>
</html> |
|