webhosting Web Hosting Wit.Com
Webhosting, Server and Web Site Help & Information
Internet Services
  Domain Names
  Web Hosting
  Accept Credit Cards
  SSL Certificates
  T1 Connections
Coding Tutorials
  HTML Tags
  HTML Code
  Style Sheets
  PHP Tutorial
  ASP Tutorial
  SQL (Database)
  ASP Code
  HTML Templates
Tips & Tricks
  Design Dos & Don'ts
  HTML Tips
  Useful Applications
  Search Engines
  My IP Lookup
Contact Us
Home Page
html basic code
free html codes
Coding Examples

The following code examples are free for you to use for your personal web projects, but may not be sold or distributed on another website without the permission of WebHostingWit.com.

Date/Time Greeter
By using the Date and Datepart functions, we can build a small section of code for greeting people with different messages depending on the date or the time.
Dim hourget

Select Case (Left(Date,5))
Case "12/25"
    Response.Write ("Merry Christmas!")
Case "07/04"
    Response.Write ("Happy Independence Day!")
Case "01/01"
    Response.Write ("Happy New Year!")
Case "02/14"
    Response.Write ("Happy Valentine's Day!")
Case Else
    hourget = Datepart("H",date)
    If hourget < 12 Then
        Response.Write ("Good Morning! It's " & Datepart("H",Date") & ":" & DatePart("N",date"))
        If hourget > 11 And hourget < 18 Then
            Response.Write ("Good Afternoon! It's " & Datepart("M",Date") & "/" & DatePart("D",date"))
            Response.Write ("Good Evening! Date and Time: " & Date)
        End If
    End If
End Select
Form Validator
To validate a form, you'll need to have the <form> tag in your html point to the asp page that will validate your code. For example:
<form method="post" action="validate.asp">
Now you'll need to create a new page called validate.asp and use the following code. Remember to change the form names to match those in your code, and to replace file.html with the form file name. In here we only check for a valid e-mail address, and make sure the first name, last name, and phone number are filled in.
<%@ language=vbscript %>
option explicit

if session("verify") <> "" then
    <!-- Put any customized html anywhere inside here -->

    <a href="file.html">Click here to return to the form file.</a>
session("verify") = ""
end if

if len(request.form("firstname")) = 0 then
    session("verify") = "Please include your first name."
end if

if len(request.form("lastname")) = 0 then
    session("verify") = "Please include your last name."
end if

if len(request.form("phonenumber")) = 0 then
    session("verify") = "Please include your phone number."
end if

if ubound(split(lcase(request.form("email")),"@",2,1)) < 1 or ubound(split(lcase(ubound(split(lcase(request.form("email")),"@",2,1)))),".",-1,1)) < 1 then
    session("verify") = "Please use a valid e-mail address."
end if

2003 Web Hosting Wit.Com and its licensors. All Rights Reserved
Designed by Fencl Web Design