Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Lecture Slides for Java Script | CMSC 102, Study notes of Computer Science

Material Type: Notes; Class: INTRO INFO TECHNOLOGY; Subject: Computer Science; University: University of Maryland; Term: Unknown 1989;

Typology: Study notes

Pre 2010

Uploaded on 02/13/2009

koofers-user-ez3
koofers-user-ez3 🇺🇸

10 documents

1 / 15

Toggle sidebar

Related documents


Partial preview of the text

Download Lecture Slides for Java Script | CMSC 102 and more Study notes Computer Science in PDF only on Docsity!

JavaScript ^ JavaScript – programming language that canappear in html pages. ^ It allow us to:^ ^ To dynamically create web pages^ ^ To control a browser application^ 

Open and create new browser windows  Download and display contents of any URL  To interact with the user  Ability to interact with HTML forms  You can process values provided by checkbox, text, textareabuttons

JavaScript ^ What is not possible with JavaScript^ ^ It is not possible to read and write files (security reasons)^ ^ The only networking support it provides is:^ 

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

JavaScript  JavaScript Interpreter – Process javaScript code  To write JavaScript programs you need^ ^ A web browser^ ^ A text editor  A JavaScript program can appear^ ^ In a file by itself typically named with the extension

.js

^ In html files between a tags  Client-Side JavaScript – the result of embedding a JavaScriptinterpreter in a web browser  Example

(See Example1.html)

^ We use document.writeln to create the page contents ^ Notice the html tags present in the writeln

JavaScript ^ When learning JavaScript we can identify two main areas^ ^ Core JavaScript – Set of rules specifying how to write JavaScriptprograms^ ^ Client-Side JavaScript – How JavaScript is used in web browsers ^ A JavaScript program can appear^ ^ In a file by itself in a file typically with the extension

.js

^ In html files between a tags  Example1 ^ We use document.writeln to create the page contents ^ Notice the html tags present in the writeln

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^ ^

 script src behaves as if contents of file appears directlybetween the tags  As event handler  Example

(See Example2.html)

^ JavaScript URLs^ ^ javascript:alert(“Welcome”)

 Statements are executed as the document is loaded  blockscan appear in a document^ ^ All are consider part of the same program^ ^ If you define a value in a block it can be referred from anotherblock

) ^ 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.,