Beginners guide [2] to ASP filled with examples!
Here is my second tutorial in basic ASP scripting. Leave comments if you want. Or have questions.
Original Author: snowboardr
Code
<% 'This ScriptName Response.write(ScriptName) %> <% Response.Redirect %> <% Response.End %> <% MyString %> <% MyCase = Select Case Case Response.write Case Response.write Case Response.write End %> Live Example at http://www.irideforlife.com/go/default2.asp <% '<%= TheCase = Select Case Case Response.write Case Response.write Case Response.write End %> <% TheMonth TheDay TheYear Response.write(TheMonth) ' %> <% TheHour TheMinute TheSecond Response.write(TheHour) ' %> <% Dim age age = Request.Form("age") %> <form If If End End %> </td> Please -Jason
ASP
- Active Server Pages [Tutorial 2] - Tutorial
1
Getting
Scriptname
is very useful, using this in your code will allow you to change the name
of your page as much as you want without having to chang any source
= Request.ServerVariables("SCRIPT_NAME")
default.asp
Live Example at http://www.irideforlife.com/go/default2.asp
Redirect
to url..
"http://www.planetsourcecode.com"
Stop
writing the page..
Response.write
"Hello there, this page needs to..."
Response.write
"Have an ending?"
Hello
there, this page needs to...
Live Example at http://www.irideforlife.com/go/default2.asp
Count
the number of chr's in your string
= "1234567"
Response.write
len(MyString)
7
Live Example at http://www.irideforlife.com/go/default2.asp
Select
Case
"3"
MyCase
1
"its 1"
2
"its 2"
3
"its 3"
Select
Select
Case QueryString
ScriptName & "?case=one" %>
'<%= ScriptName & "?case=two" %>
'<%= ScriptName & "?case=three"%>
Request.QueryString("case")
TheCase
"one"
"its 1"
"two"
"its 2"
"three"
"its 3"
Select
Live Example at http://www.irideforlife.com/go/default2.asp
Writing
m / dd/yyyy
= month(date)
= day(date)
= year(date)
& "/" & TheDay & "/" & TheYear
& Seperates each thing.
Live Example at http://www.irideforlife.com/go/default2.asp
Writing
HH:MM:SS
= hour(time)
= minute(time)
= second(time)
& ":" & TheMinute & ":" & TheSecond
& Seperates each thing.
Live Example at http://www.irideforlife.com/go/default2.asp
Getting
Form Results
name="form1" method="post" action="<%=ScriptName
& "?submit=form" %>">
<table width="9%" border="0" cellspacing="0"
cellpadding="0">
<tr>
<td><font size="2" face="Verdana, Arial, Helvetica,
sans-serif"><18</font></td>
<td><font size="2" face="Verdana, Arial, Helvetica,
sans-serif">
<input type="radio" name="age" value="<18"
<% if age = "<18" then Response.write
"checked" %> >
</font></td>
</tr>
<tr>
<td><font size="2" face="Verdana, Arial, Helvetica,
sans-serif">18-21</font></td>
<td><font size="2" face="Verdana, Arial, Helvetica,
sans-serif">
<input type="radio" name="age" value="18-21"
<% if age = "18-21" then Response.write
"checked" %> >
</font></td>
</tr>
<tr>
<td><font face="Verdana, Arial, Helvetica, sans-serif"
size="2">22 ></font></td>
<td><font size="2" face="Verdana, Arial, Helvetica,
sans-serif">
<input type="radio" name="age" value="22>"
<% if age = "22>" then Response.write
"checked" %> >
</font></td>
</tr>
<tr>
<td colspan="2">
<input type="submit" name="Submit" value="Submit">
<%
Request.QueryString("submit") = "form"
NOT age = "" Then ' Lets make sure the
form wasn't submited with nothing checked.
Response.write "You are in the "
& age & " age range!
If
if
</tr>
</table>
</form>
Live Example at http://www.irideforlife.com/go/default2.asp
post comments below and vote if this helped...thanks!
Loading Comments ...
Comments
No comments have been added for this post.
You must be logged in to make a comment.