Beginners guide to ASP filled with examples!
Posted: 2002-06-01
By: ArchiveBot
Viewed: 64
Filed Under:
No attachments for this post
This is example for anyone who is just starting ASP. These are easy examples to understand. A live example of this can be found here:
http://www.irideforlife.com/go?x=view
If you like it the please vote!
Original Author: snowboardr
Code
<% Response.write %> <% Response.write %> <% Response.write %> <% Response.write %> <% Response.write Note: A comment has a single quote in front of %> <% If "2" Response.write"True" End if %> <% If "2" Response.write Else Response.write End if %> <% 'If If Request.QueryString("display") Response.write End if %> <% <!--#include file="myfile.asp"--> %> Includes a file into your page. This makes it easy to have a bunch <% Response.write 'Note: 'Example: %> Live Examples Here : http://www.irideforlife.com/go?x=view <% Response.write If Request.QueryString("display") Response.write(Request.Form("areform")) End if %> Live Examples Here : http://www.irideforlife.com/go?x=view <% ' MyText = Response.write(MyText) %> Hello World! <% MyString NewString 'Notes: Response.write(NewString) %> Jason is the worst programmer in the world! <% a b c Response.write(c) Response.write a b If Response.write End %> 2 <% MyArayString sAray For Response.write Next %> Leave Ill
ASP
- Active Server Pages
Outputing
text
"Hello World"
Hello World
Outputing
text a second way
("Hello World")
Hello World
<html>
& ASP
("<b>Hello World<b>")
Hello World
Writing
Date / Time
NOW
3/9/2002 8:15:19 PM
Comenting
your code:
"Hello World" 'Outputes "Hello
world"
it. (')
Hello World
If
Statement
= "2" Then
True
If
...Else
= "3" Then
"True"
"Its
2!"
Its 2!
Request.QueryString
our QueryString matches what we want then we can show what we want
= "message" then
"My message"
My message
Include
file
of code that you use all the time on one page, but yet you don't have
to have a big long page of it. You can also just update the file with
all your code, and then each page that has the include will have the
update as well.
Write
a form in ASP.
"<form name=""form1"" method=""post""
action=""default.asp"">"
Response.write
"<input type=""text"" name=""textfield"">"
Response.write
"<input type=""submit"" name=""Submit""
value=""Submit"">"
Response.write
"</form>"
Each quote inside the Response.write quotes must have double quotes!
Response.write "Hello there ""Welcome"" to my
site!"
Show
your form results on the same page..
"<form name=""form2"" method=""post""
action=""default.asp?display=formresults"">""
Response.write
"<input type="text""
name=""areform"">"
Response.write
"<input type=""submit"" name=""Submit""
value=""Submit"">"
Response.write
"</form>"
= "formresults" then
Dim
to memory
Use this to store anything you want for use later also known as a string
"Hello World!"
Replace
something in a string
= "Jason is the best programmer in the world!"
= Replace(MyString, "best","<b>worst</b>")
YourNewString = Replace(String to look in, "Word
that you want to look for", "Repalce with this"
)
Math:
= "1"
= "2"
= a * b ' Multiplication
"<br>"
= "1"
= "2"
a < b Then
"yes b is greater then a"
if
yes b is greater then a
Aray:
= "a b c | d | e f | g h i j | k l m n | o p | q r s | t u v | w
y x z"
= Split(MyArayString, "|") 'Split up our
data in between | |
each
x in sAray
x
'Goto next one until it there are no more
a b c d e f g h i j k l m n o p q r s t u v w y x z
comments below.
probably continue on ths lesson if someone wants me to.
Comments on this post
No comments have been added for this post.
You must be logged in to make a comment.