Tutorial 16: Client-Side Scripting 101 - HTML with Style | WebReference

Tutorial 16: Client-Side Scripting 101 - HTML with Style

index12345678

Tutorial 16: Client-Side Scripting 101

So what is a script anyway?

HTML is, as I've said before, a language used to create hyperlinked text documents, which as a total comprise what is called the World Wide Web. CSS is a language used to control the presentation of these documents. Sometimes, these documents are not static, unchanging texts, but are created by computers on-the-fly. To facilitate this, technologies were developed several years ago that create Web pages dynamically. Programs that do this run on Web servers, and usually use data from some source (e.g. a database) and some user input (e.g. the data submitted via an HTML form), process these, and create output in the form of a Web page.

These kinds of programs differ from other kinds of computer programs in that their output is not sent to a screen, printer or file, but is a Web page. The output of these programs is no different from a static HTML document in any way. In order to write such programs, you have to learn HTML just as if you were designing a static set of documents. The only difference is that these programs automate the procedure.

However, after a while, someone came up with the idea of sticking programs straight into Web pages, so that these Web pages would turn into small applications that run on user's computers. These programs are called client-side scripts, because they run on the client (i.e. the browser displaying the document) as opposed to the server (i.e. the computer offering the document).

Scripts and name-calling

You can write scripts in any language you want, but they will only run on browsers that support that language. This means that, most of the time, you will be restricted to the language JavaScript, which is by far the most widely supported scripting language today. If you don't like it, you're out of luck. Alternatives include Microsoft's VBScript, which works fine but only on Internet Explorer. There are also various other scripting languages, but most of them require a plug-in or special browser to work, and as such are pretty useless on the Web.

Contrary to popular belief, JavaScript has very little to do with the programming language Java. It's called JavaScript because the syntax (the way you write programs) in JavaScript is in some ways similar to that in Java, and because JavaScript occasionally behaves in a way reminiscent of object-oriented languages (if you're not a programmer, you probably don't care what that is), of which Java is a very good example. You could say that JavaScript was inspired by Java, but that's about it. Learning JavaScript won't get you any closer to knowing Java, and vice versa.

Microsoft calls its implementation of JavaScript "JScript," although the two are mostly the same, and usually the term "JavaScript" is used for both. You might also occasionally hear the name "ECMAScript." ECMAScript is a language, or rather a type of language, defined by the ECMA-262 standard, produced by ECMA, the European association for standardizing information and communication systems. ECMAScript evolved from JavaScript and JScript, and aimed to create a standard version of JavaScript syntax. Newer versions of both JavaScript and JScript in Navigator and Internet Explorer claim to conform to this standard. From now on, whenever I say "JavaScript," I mean all of the above. You might also chance upon the phrase "a JavaScript" used instead of "a script written in the JavaScript language." It's not that confusing. Really it isn't.

index12345678

URL: http://www.webreference.com/html/tutorial16/1.html

Produced by Stephanos Piperoglou
Created: September 15, 1999
Revised: September 27, 1999