Javascript Course Notes

Topics: HTML, JavaScript, Document Object Model Pages: 47 (9708 words) Published: May 3, 2013
JavaScript Essentials
The purpose of most JavaScript scripts is to make a Web page interactive, whether or not a program is running on the server to enhance that interactivity. Making a page interactive means tracking user action and responding with some visible change on the page. The avenues for communication between user and script include familiar onscreen elements, such as fields and buttons, as well as dynamic.

To assist the scripter in working with these elements, the browser and JavaScript implements them as software objects. These objects have properties that often define the visual appearance of the object. Objects also have methods, which are the actions or commands that an object can carry out. Finally, these objects have event handlers that trigger the scripts you write in response to an action in the document (usually instigated by the user).

JavaScript is a cross-platform, object-oriented scripting language. JavaScript is a small, lightweight language; it is not useful as a standalone language, but is designed for easy embedding in other products and applications, such as web browsers. Inside a host environment, JavaScript can be connected to the objects of its environment to provide programmatic control over them. Core JavaScript contains a core set of objects, such as Array, Date, and Math, and a core set of language elements such as operators, control structures, and statements. Core JavaScript can be extended for a variety of purposes by supplementing it with additional objects; for example: * Client-side JavaScript extends the core language by supplying objects to control a browser (Navigator or another web browser) and its Document Object Model (DOM). For example, client-side extensions allow an application to place elements on an HTML form and respond to user events such as mouse clicks, form input, and page navigation. * Server-side JavaScript extends the core language by supplying objects relevant to running JavaScript on a server. For example, server-side extensions allow an application to communicate with a relational database, provide continuity of information from one invocation to another of the application, or perform file manipulations on a server. Javascript: What can it do?

Here are some of the main programming features that Javascript supports: •Javascript supports standard programming constructs such variables, loops, decision-making, etc. •Javascript supports objects. It has an extensive library of built-in objects including browser windows, frames, links, forms, form elements (such as buttons), etc. You can also create your own objects. •Javascript supports functions, which are procedures that do work and return a value. Javascript has some built-in functions (e.g. parseInt() translates a numeric string into a whole number) or you can create your own. •Javascript is an event-driven language. You can write a block of Javascript code that does something in response to the action of the user, e.g. open a new browser window when a user clicks on a button.

Given its capabilities and limitations, here are some tasks for which Javascript is well suited: •Enabling users to interact with HTML pages. Javascript code can respond directly to user interaction with elements (text boxes, buttons, check boxes, drop-down selection lists, and so on), images, and hypertext links. •Validating data on the client before submitting it to the server (but don't rely on it!). •Spicing up web pages with the date, time, status bar messages, scrolling banners, and so on. •In combination with XML (Extensible Markup Language) and server-side languages such as PHP, providing the sort of rich, dynamic client-side experience associated with websites such as Google Maps and GMail. This technology is known as AJAX (Asynchronous Javascript and XML) and we will look at it briefly at the end of the course if we have time.

When to use JavaScript
Data entry validation: If form fields need to be...
Continue Reading

Please join StudyMode to read the full document

You May Also Find These Documents Helpful

  • course note Essay
  • Course Notes Essay
  • Essay about Course Notes
  • Course Notes Essay
  • Course Notes Research Paper
  • Course Notes Essay
  • Course Notes Essay
  • Course Notes Essay

Become a StudyMode Member

Sign Up - It's Free