CLIENTSIDE SCRIPTS - PowerPoint PPT Presentation

1 / 32
About This Presentation
Title:

CLIENTSIDE SCRIPTS

Description:

VBScript. Server-Side Script. Server-Side Includes (SSI) Active Server Pages (ASP) ... VBScript. Used in client and server-side. Used in scripting ASP ... – PowerPoint PPT presentation

Number of Views:51
Avg rating:3.0/5.0
Slides: 33
Provided by: pcbstud
Category:

less

Transcript and Presenter's Notes

Title: CLIENTSIDE SCRIPTS


1
CHAPTER 7
  • CLIENT-SIDE SCRIPTS
  • Khai Le

2
An Overview
3
Definition
  • Scripts
  • Source codes that is interpreted into machine
    language one line at a time
  • Machine Language
  • Binary language understood by computer

4
TWO TYPES OF SCRIPTS
  • Client-side
  • Run on users computer
  • Server-side
  • Run on Web servers

5
SCRIPTS EXAMPLES
  • Client-Side Script
  • JavaScript
  • VBScript
  • Server-Side Script
  • Server-Side Includes (SSI)
  • Active Server Pages (ASP)

6
USAGE OF CLIENT SIDE SCRIPTS
  • Primary usage is to validate user inputs entered
    on web (HTML) forms
  • Other uses
  • Cookies

7
HTML FORMS
  • HTML Form
  • Enhanced HTML documents designed to collect user
    information and send them back to a server
  • Create by a form ltINPUTgt tag in the HTML document

8
HTML FORMS TYPES
  • Input Box (text box)
  • Radio or option button
  • Selection list (list box)
  • Submit command button
  • Reset command button

9
TYPE ATTRIBUTE OF ltINPUTgt TAG
  • ltINPUT TYPETEXTgt
  • Specify the input control is a text box where
    user input is displayed as it was entered
  • ltINPUT TYPE PASSWORDgt
  • Same as the text box but the characters are
    masked with special characters

10
Cont.
  • ltINPUT TYPECHECKBOXgt
  • Specifies a check box control
  • If CHECKED is included after the CHECKBOX then
    when the form is first displayed the checkbox
    control will be checked
  • VALUE specifies the value of the checkbox of
    either On or Off

11
Cont.
  • ltINPUT TYPE RADIOgt
  • Specify a radio or option button control
  • If CHECKED is included then it will be selected
    when the form is first displayed
  • VALUE specifies the value of the radio button

12
Cont
  • ltINPUT TYPEBUTTONgt
  • Specifies a command button
  • ONCLICK attribute specifies the name of a program
    that is called when the user click the command
    button
  • VALUE attribute is used to specify a different
    caption instead of the defaulted Button

13
Cont.
  • ltINPUT TYPE SUBMITgt
  • Specifies a command button with a Submit
    caption
  • When click, all value of fields will be submitted
    as parameters to the form-processing program

14
Cont.
  • ltINPUT TYPERESETgt
  • Specifies a command button with a Reset button.
  • When click, all form control values are cleared
    and the form is returned to its default state
  • VALUE attribute specify desired captions

15
OTHER TAGS
  • ltINPUT TYPEHIDDENgt
  • Create a hidden form field invisible to user but
    can be used to submit data to the processing
    program. E.g. Date recording
  • TEXTAREA Element Tags
  • Specifies input box with multiple lines of text
    using ROW and COLS attributes

16
Cont.
  • SELECT Element Tag
  • Specifies a list box
  • Use SIZE attribute to control number of displayed
    item

17
SCRIPTS
  • Scripts can be used to perform data validation.
  • Why use scripts?
  • Faster to create
  • Faster to modify
  • Small size

18
SCRIPTS
  • PERL
  • Practical Extraction and Report Language
  • Developed in 1987 by Larry Wall
  • Intended to be use as a UNIX operating scripting
    language
  • Does not run in a Web browser
  • Used only on server-side scripts

19
SCRIPTS
  • JavaScript
  • Developed in 1995 by Netscape
  • Originally designed for server-side
  • Changed to client-side
  • Syntax is similar to C, C, and Java but behave
    differently
  • Often used in data validation and creating pop up
    windows

20
SCRIPTS
  • VBScript
  • Used in client and server-side
  • Used in scripting ASP
  • Related to Visual Basic programming language
  • Work best on Microsoft browser

21
SCRIPTS
  • ASP
  • Contains script-processing and HTML command
  • Processed on a Microsoft Web server
  • Produced dynamic web page for users browser

22
CREATING CLIENT-SIDE VBSCRIPT
  • VBScript code is embedded in the header section
  • ltSCRIPT LANGUAGEVBSCRIPTgt
  • program lines
  • lt/SCRIPTgt
  • Need Microsoft s Browser to work

23
DEBUGGING
  • Remember to save your modified version
  • View source code to determine whether it had the
    latest version
  • Make sure the page is not cached
  • Check the code lines

24
CREATING COOKIES
  • Cookie is a data file written to the users
    computer by a program in a Web page
  • Contain information of visitors to web page
  • A single cookie can contain 4096 characters

25
TYPES OF COOKIES
  • Temporary cookie
  • Store info in main memory of users computer and
    valid only during active session
  • Unavailable when user exits browser
  • Associated with HTML document
  • Stored as text strings.

26
Cont.
  • Persistent Cookies
  • Store values which are available to future
    browsing sessions
  • Same syntax as temporary but with an expiration
    date
  • Maximum of 300 cookies in a users computer

27
DISPLAY WEB PAGE USING CLIENT-SIDE SCRIPT
  • Start a new browser session and open a new
    browser window with the new Web page displayed.
  • Display the new Web page in the current browser
    window (pop up windows)

28
DISLAYING A WEB PAGE IN A NEW BROWSER WINDOW
  • Usually done when the new page is unrelated to
    the current page or does not share data
  • Allow multiple windows for users to view
    simultaneously
  • Format (VBScript)
  • Window.Open URL, Target, Option List

29
Cont.
  • URL
  • Address of the new page
  • Target
  • Name given to the new window
  • Option List
  • Specify the properties of the new browser window
    such as location, toolbar, status, scrollbar,
    resizable, width, height, etc.

30
DISPLAY A WEB PAGE IN THE CURRENT PAGE
  • Use the Navigate method to display a new Web page
    in the current browser window
  • Format Navigate(Web page URL)
  • Save space on taskbar
  • No need to close multiple browser window

31
SUMMARY
  • Client-side script is uncompiled code that is
    compiled on the users computer
  • Used primarily in data validation on HTML forms
  • Script are small programs using languages such as
    PERL, JavaScript, VBScript, etc
  • Cookies store information about a visitors visit
    to a web site

32
THE END
  • NO QUESTION PLEASE!!!
Write a Comment
User Comments (0)
About PowerShow.com