









Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Notes; Class: INTRO INFO TECHNOLOGY; Subject: Computer Science; University: University of Maryland; Term: Unknown 1989;
Typology: Study notes
1 / 15
This page cannot be seen from the preview
Don't miss anything!










It can send the contents of forms to a server and e-mailaddresses It can cause the browser to load a web page ^ JavaScript is not Java, however …^ ^ JavaScript program constructs are similar to Java’sconstructs (in many cases identical)^ ^ JavaScript can interact with java programs
.js
Embedding JavaScript in HTML ^ Different ways to embed JavaScript in HTML^ ^ By using tags in the html document^ ^ From an external file (specified via URL) using the srcattribute of the script tag^ ^
(See Example2.html)
^ JavaScript is not the only language out there^ ^ Visual Basic Scripting Language (language = “VBScript”) ^ IE and Netscape will assume JavaScript if language is not specified. ^ The^ language
attribute allows you to specify a JavaScript version to use (e.g.,
(See Example3.html and footer.js) ^ The src specifies an URL as its value ^ Advantages of external file^ ^ Simplifies html files by removing code file^ ^ Allows you to share code among html files^ ^ Improves efficiency by allowing the web browser tocache the code
Execution of JavaScript Programs^ ^ HTML parser – Takes care of processing an htmldocument^ ^ JavaScript interpreter – Takes care of processingJavaScript code^ ^ HTML parser – must stop processing an html file whenJavaScript code is found (JavaScript interpreter will thenbe running)^ ^ This implies a page with JavaScript code that is computationallyintensive can take a long time to load
var
var name; Variables names must start with a letter and can be followed byletters and digits A variable can hold different type of values Values we can assign to variables Integer – 0, 10, 40, 6, -7 Floating-point – 3.2, .67, 1.48E-20 String literals – “hello”, “goodbye” Operators Typical arithmetic operators (+, -, *, /) Example 5
(See Example5.html)
prompt, Example 6
(See Example6.html)
^ Notice we can define several variables at the sametime Comments ^ Can be defined using // (Everything until end of theline is a comment) ^ Can be defined using /* / (Everything in between /and / is considered a comment. ^ / */ can span several lines (// don’t)