Commonly Used HTML tags Cont.Tag Operation Example Result Begin/End Body of Web page … Begins and ends the body of the web page Start/End paragraph ParagraphNew Paragraph Paragraph
Trang 2• Electronic Commerce - the use of Web sites to sell
goods and services over the Internet.
• The World Wide Web (Web) - a body of software and a
set of protocols and conventions based on hypertext and multimedia that make the Internet easy to use and browse.
• hypertext - a capability to jump between and within
documents virtually at will.
• client/server computing - processing is shared between multiple small computers known as clients that are
connected via a network to a host computer known as a
server.
• uniform resource locator (URL) – protocol that allows
your browser to communicate with remote hosts.
Trang 3Displaying Information with a Browser
• When displaying information sent to it from the server, the browser processes formatting instructions included in the text file retrieved from the server.
• The server stores the data with tags to indicate how text and
other forms of information will be displayed.
• The tags in the World Wide Web are part of a special
publishing language called hypertext markup language
Trang 4Commonly Used HTML tags
Tag Operation Example Result
<B> Boldface text <B>Hello</B> Hello
<I> Italicized text <I>Hello</I> Hello
<CENTER> Centered text <CENTER>Hello</CEN
<BR> Line Break End this line.<BR> Start
another line End this line. Start another line.
<HTML> Begin/End HTML <HTML>…</HTML> Begins and Ends
Web Page
<TITLE> Begin/End Title of
Web Page <TITLE>Web page for CH 13</TITLE> “Web page for CH 13” appears in
header bar of browser.
Trang 5Commonly Used HTML tags (Cont.)
Tag Operation Example Result
<BODY> Begin/End Body
of Web page <BODY>…</BODY> Begins and ends the body of the web page
<P> Start/End
paragraph <P>Paragraph</P><P>New Paragraph</P> Paragraph New Paragraph
<H1> Create type 1
(largest) heading (also 2, 3, 4)
= …> Include image in web page <image src = “family.jpg”> jpg image file named family is displayed
<FORM> Create an input
form on a web page
<FORM NAME = Order>…</FORM> Creates an input form named “Order”
<INPUT TYPE = text>
Create text box for input <INPUT TYPE = text NAME = txtOrder> A text box for input is displayed
Trang 6• Script placed in the body is automatically executed as the Web page is loaded into the browser.
Trang 8Scripting in the Browser
• An important use of Web browsers in electronic commerce is
• Instead of being executed as a compiled program, it is executed by another program, in our case the Web browser.
• Scripting languages are easier to work with than compiled
Trang 9• Javascript uses a C-like syntax and can run on either
Netscape or Internet Explorer browsers.
• VBScript is based on Visual Basic, but runs only on Internet
Explorer.
• Both Javascript and VBScript, when used on the browser,
are termed client-side scripting since they are running on
the Web client.
• VBScript is also widely used in the Active Server Page
(ASP) approach to directing Microsoft Web server software
that runs on Windows NT or 2000 operating systems This is
called server-side scripting.
Trang 10Uses different types of variables and constants
Uses only one type of the Variant
variable Can be compiled into an exe file Is interpreted by the Internet
Explorer browser software Uses event procedures to react to
Trang 11• VBScript programs must be interpreted by other
software, usually the Internet Explorer browser on the client side and Web server software on the
server side.
• In VBScript, we can write code to respond to the events, these code procedures are referred to as
event handlers.
• Since there is no easy-to-use IDE for VBScript that
is readily available, it is convenient to use a text
editor like NotePad.
• VBScript must be tightly integrated with the
HTML.
Trang 12The <Script> Tag
• All VBScript code must be enclosed in HTML script tags.
<SCRIPT language=”VBScript”> </SCRIPT>
• The same type tags are used for Javascript with a change in the language parameter.
• VBScript code is typically located in two places in the Web page—in the HEAD section and in the BODY section
• When VBScript is placed in the HEAD section, it is in the form of functions and sub programs that act as event handlers
• When VBScript code appears in the BODY section of the HTML code, it is executed when the page loads.
Trang 13Form <FORM ACTION = mailto:videosv@negia.net NAME =
frmInput METHOD = post ENCTYPE = text/plain> </FORM> Text Box <INPUT TYPE = text NAME = txtPhoneNum>
List Box <SELECT NAME=lstVideos> </SELECT>
Item in List Box <OPTION VALUE=1>Bambi</OPTION>
Radio Button <INPUT TYPE=radio NAME=optChooseOne>
Check Box <INPUT TYPE=checkbox NAME=chkFirstOption>
Submit Button <INPUT TYPE=Submit VALUE=”Submit Order”
Trang 14<H1 ALIGN=center>Vintage Videos Online Rental Form</H1>
<FORM NAME=frmInput METHOD=post ACTION=mailto:videosv@negia.net ENCTYPE=text/plain>
<H3>Please input your name, telephone number including area code, and e-mail address:</H3>
<H3>Name: <INPUT TYPE=text NAME=txtName></H3>
<H3>Telephone Number: <INPUT TYPE=text NAME=txtPhoneNum></H3>
<H3 align=left>E-mail Address: <INPUT TYPE=text NAME=txtEmail></H3>
<H3>Now, select a video to rent and have delivered:</H3>
Trang 15HTML Code for Input Form (Part 2)
<OPTION value=2>Blazing Saddles</OPTION>
<OPTION value=2>Ben Hur</OPTION>
<OPTION value=3>Spartacus</OPTION>
<OPTION value=2>Tootsie</OPTION>
<OPTION value=3>The Sting</OPTION>
</SELECT>
<H3>The video you have selected is: <INPUT TYPE=text NAME=txtVideo>
The price of this video is: <INPUT TYPE=text NAME=txtprice>
The delivery fee and taxes are: <INPUT TYPE=text NAME=txtDeliveryFee>
<H3>The total cost is: <INPUT TYPE=text NAME=txtTotalCost>
<H3>If you are satisfied with the results and want the video delivered, click the Submit button To start over, click the Reset button.</H3>
<INPUT TYPE=submit NAME=cmdSubmit VALUE="Submit Order">
Trang 17The Validation Process
• The validation process on a Web page is similar in many ways to the validation process for Visual
Basic forms.
• Typical validation questions are:
– Is there an appropriate number of digits in a name or telephone number?
– Is there an @ sign in an e-mail address with a sufficient number of characters?
– Are there exactly nine digits in a Social Security number with dashes in the correct location?
– Are there an appropriate number of characters in a credit card number?
Trang 18strPhone = frmInput.txtPhoneNum.Value strEmail = frmInput.txtEmail.Value
If Len(strName) < 5 Then Msgbox "Please input a name at least 5 characters long!"
frmInput.txtName.Value = ""
frmInput.txtName.Focus frmInput_OnSubmit = False Exit Function
ElseIf Len(strPhone) <> 12 Then Msgbox "Please input a phone number with exactly 12 digits!"
frmInput.txtPhoneNum.Value = ""
frmInput.txtPhoneNum.Focus frmInput_OnSubmit = False Exit Function
ElseIf InStr(strEmail,"@") = 0 Or Len(strEmail) < 5 Then Msgbox "Please input an e-mail address with an @ sign" _ & "and at least 5 characters!"
frmInput.txtEmail.Value = ""
frmInput.txtEmail.Focus frmInput_OnSubmit = False Exit Function
End If End Function
</SCRIPT>
Trang 19frmInput.lstVideos.Focus frmInput_OnSubmit = False Exit Function
End If
Trang 20intIndex = frmInput.lstVideos.SelectedIndex strVideoName =
frmInput.lstVideos.Options(intIndex).Text frmInput.txtVideo.Value = strVideoName End Sub
Trang 21Case 1 curVideoprice = 99 Case 2
curVideoPrice = 1.99 Case 3
curVideoPrice = 2.99 End Select
frmInput.txtPrice.Value=FormatCurrency(curVideoPrice)
Trang 22FormatCurrency(curTaxesFees) curTotal = curVideoPrice + curTaxesFees frmInput.txtTotalCost.Value = FormatCurrency(curTotal)