AhmedJSPart2

AhmedJSPart2 - JavaScript Handout 2 Introduction to...

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon
JavaScript Handout 2 Introduction to Client-Side JavaScript Programming Language Lecture Notes by: Mesbah U. Ahmed Note: JavaScript is an essential tool in today’s web development practices. It is the most universally accepted language that plays a major role in Dynamic HTML (DHTML), manipulation of CSS, XML, Ajax, and RSS. Its features and capabilities are almost unlimited, and its real value depends on a developer’s knowledge in programming and data structures, browser’s technologies at the background, and in W3C’s specifications on Document Object Model. The objective of this handout is to make it easier for you to learn introductory concepts of JavaScript as programming language. The venture has been a sole effort without any secretarial assistance. So you will find many typos and “bloopers”. My apologies in advance! Please do not use the handout as the only “learning source”. In parallel, please read the relevant topics from the textbook, and always feel free to search Google! We will not cover the entire handout. Many of the examples and topics discussed in this handout have already been discussed in our class. The sample codes are available in the AhmedsJSPart2.zip file - Mesbah Ahmed   AhmedJSPart2.doc Page 1 of 34
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2.1: Lexical Structures: AhmedJSPart2.doc Page 2 of 34
Background image of page 2
AhmedJSPart2.doc Page 3 of 34
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
AhmedJSPart2.doc Page 4 of 34
Background image of page 4
2.2: Immediate Scripts: In some of our examples, we have placed JavaScript codes in the event attribute’s values. This code will not be executed unless the respective events happen. Initially when the browser displays the page, it goes through every line of your HTML code and resolves the <tags> (that means it displays the contents of the tags). However, it ignores the instructions specified in the event attributes (unless the event happens). In addition to inserting codes in an event attribute, we can simply insert JavaScript code in the <body> of an HTML document (of course within the <script></script> tags). These scripts are often called Immediate Scripts. In commercial Web Pages, the Immediate Scripts may not lay a great role, but these are extremely useful for learning and to practice JavaScript syntax. Remember, the Immediate Scripts are simply JavaScript codes inside <script> tags in the <body> section. Here is an example: In the above code, observe that the <script> tag has been included inside the <body> element just like any other HTML tag (such as <p>, <div>, <table> etc. When the browser loads the document into a Web page, it will simply go in sequence and treat the <script> tag exactly like any other HTML tag. Thus it will execute the JavaScript instruction when it comes to the <script> tag. It will not wait for any event to occur. AhmedJSPart2.doc
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 34

AhmedJSPart2 - JavaScript Handout 2 Introduction to...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online