Script Integration

coordinatedcapableSoftware and s/w Development

Nov 4, 2013 (3 years and 11 months ago)

97 views

Script Integration

EBT 488

Applications Development
for E
-
Business

Scripting Technologies


Scripting technologies allow Web programmers to
create dynamic Web pages


A
script

is a series of commands that belongs to a
scripting language

(JavaScript or VBScript) that are
embedded within a Web page


Scripting languages use a program called an
interpreter

to translate the script code into an
executable format


Scripts that are run on a Web server are called server
-
side scripts


Client
-
side scripts run in the browser; they are
interpreted when a browser downloads the Web page

Client
-
Side Scripting


A pair of script tags separates client
-
side script from
HTML code


The script tag
<SCRIPT>

identifies the beginning of a
script, and the
</SCRIPT>

identifies the end of the
script


A scripting engine built into the browser processes
client
-
side scripts


When a Web browser identifies a client
-
side script, the
browser passes the script to the
script engine
, which
executes the script as the page is being loaded

Client Side Scripting Languages


JavaScript:


most commonly used
client
-
side scripting
language


supported by most
browsers


several versions
(JScript)


You can specify which
JavaScript Version to
use


VBScript:


A scaled
-
down version
of the Microsoft
programming language
Visual Basic


designed to be a fast,
portable interpreter for
use in Web browsers
and applications


only supported by
Internet Explorer
(Microsoft)


Client
-
Side Scripting


Scripts can be placed in the head or body sections of the
Web page


If you place a script in the head section of the Web page, the script
engine interprets that script before it interprets scripts located in the
body section


When a script is at the end of the Web page, the Web page loads
faster, and users can continue viewing the page while the script
engine interprets the script


You can place client
-
side scripts in a document separate from
the HTML document


This allows you to reuse scripts across multiple Web pages simply by
including a pointer to the script source file


Server
-
Side Scripting


Used to add interactivity to a Web pages and to
allow interaction with other programs on the
server


A
scripting engine

installed on the server
interprets

server
-
side scripts


After the scripting engine runs the script, the
scripting engine sends the
output of the script

back to the browser


Server
-
side script source code
never

appears in
the browser

Active Server Pages


Microsoft’s implementation of server scripting
technology is referred to as
Active Server Pages
(ASP)


All
Active Server Pages

must have an
.asp

file
extension


When the
client

(browser) requests a file with an
.asp

extension, the Web server knows to process
the server
-
side scripts on the Web server and send
the results to the client

Server
-
Side Scripts


There are two ways to indicate that a
script is to be interpreted on the server


The first way is to add the
runat = server

attribute within the beginning
<script>

tag


This technique is known as
block scripting


The second method you can use to identify
server scripts is
inline

scripting


All code enclosed within the inline script tags
<%….%>

is interpreted on the server

Server
-
Side Include Files


External script files on the server are called
server
-
side include (SSI) files


Server
-
side include files

allow the programmer to
reuse code for multiple Web pages


Server
-
side include files can contain server
-
side
scripts as well as HTML and client
-
side scripts


The included file will be included
before

the ASP
engine interprets any other scripts on the page