Scripting Basics
Scripting Basics
com
Engaging Peers, Inspiring Careers!
• Limitations of Scripting
Scripting Basics
• Html is a powerful mechanism for layering out pages.
• The intent with java is to have a single code base that, when compiled to
byte code, runs properly on all platforms.
• Java, however, is a lot more challenging to learn than many web designers
would like.
Compiled Programs
• Once the program has been compiled, that ca be run on platform for
which it has been compiled without any other program.
• The first version of javascript contained most of the core functionality for
the scripting language.
Jscript
• For example,
• The <script> tag has a closing tag, </script>, to denote the end of the
script.
Placing Scripts in your HTML code
• Client – Side scripts can be placed anywhere in the html text.
• The most common place for scripts is head section.
• Using a script tag in the header section is a good place to define all the
subroutines.
• JavaScript embedded in the <head> section
<head>
<title> Java Scripting </title>
<Script Language=“javascript”>
function display_message(string_messgae)
{
window.staus = string_message;
}</script> </head>
Placing Scripts in your HTML code
• The script can be included in the body of the html document, when the
script needs to write some dynamic code to the document as it’s being
parsed upon loading.
<script language=“javascript”>
if ( useragent == “Netscape”)
</script>
Placing Scripts in your HTML code
• Javascript example embedded in html tags
<a href=“toc.html”
onMouseOver=‘window.status=“Return to table of contents”;return true’
onMouseOut=‘window.status=“ “; return true’>
• Client side scripts are run by loading the web page in which they are
embedded into a web browser that supports that scripting language.
• Client - Side scripts are also somewhat limited in the actions they can
perform.
• Client – side scripts must contain commands that are independent of the
platform on which they are run.
• Client – Side scripts do not possess all of the power of CGI scripts.
• CGI script is needed to handle the form data after it has been validated.