* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download Javascript
Survey
Document related concepts
C Sharp syntax wikipedia , lookup
Abstraction (computer science) wikipedia , lookup
Library (computing) wikipedia , lookup
Programming language wikipedia , lookup
Smart Pascal wikipedia , lookup
Falcon (programming language) wikipedia , lookup
Program optimization wikipedia , lookup
Object-oriented programming wikipedia , lookup
Assembly language wikipedia , lookup
History of compiler construction wikipedia , lookup
Structured programming wikipedia , lookup
Comment (computer programming) wikipedia , lookup
Go (programming language) wikipedia , lookup
C Sharp (programming language) wikipedia , lookup
Transcript
JAVASCRIPT DEFINED JavaScript Basics Definitions JavaScript is an object-oriented programming language designed for the world wide web. JavaScript code is embedded directly into common HTML documents and is interpreted by the web browser when the document is loaded. JavaScript allows web developers to include high levels of interactivity in web pages. Broad support among web browsers (enabled by default) Libraries of scripts available Allows use of reusable code libraries Similar syntax to C, C++, and Java Encourages creative problem solving WHY LEARN JAVASCRIPT? Enhance interactivity (mouseover swap, games etc). Provide interesting visual effects (image sliders,snow falling, cursor trails). Provide tooltips on “focus”. Validate forms for accurate data. SOME EXAMPLES OF USAGE PROGRAMMING LANGUAGES I Each programming language was created to solve some type of particular problem. There are hundreds of programming languages. The instructions in a computer program tell the computer what steps to take to solve a problem. Programming languages specify an exact sequence or order of operations. Program logic determines the next step to execute in a procedural language and this logic determination is made in response to conditions and user action. The traditional procedural languages include but are not limited to: BASIC, C, COBOL, FORTRAN, Pascal, C++. "Compiled language" means the source code of the program is translated (compiled) into machinelanguage (composed only of 0's and 1's) before use. When it is time to run the program, the translated version is used by the computer instead of the original source code. Unless you are the programmer, you might never see the source code of the program you are using. "Interpreted language" means when it loads a page, the browser's interpreter uses the original source code and translates it into machine language. The translation is stored in the browser's memory ready to run all or portions of it as appropriate. When the browser window gets ready to load a different web page, the previous page's translated JavaScript is discarded. COMPILED VS INTERPRETED HOW THE BROWSER KNOWS IT IS JAVASCRIPT: JavaScript code must be between <script...> </script> tags or situated in an external .js file. In XHTML/HTML 4 the text attribute is required: <script type="text/javascript"> // javascript code is located between the opening and closing script tags. </script> In HTML 5 the text attribute is optional: <script> // javascript code is located between the opening and closing script tags. </script> Comments: // This is a single-line javaScript comment. /* This is a multi-line javascript comment */ USING JAVASCRIPT WITH EXPRESSION WEB As web designers we work in code view.* We copy the javascript code from the source. Following directions of the programmer, we paste the code into the head or body of the html document that is open in EW. If images are required for the script, we save them to our flashdrive and import them into EW. Some scripts provide variables that we can modify to our specific needs. *Exception to this is the EW Behaviors task pane JAVASCRIPT EXAMPLES