CIS 388 Internet Programming Javascript Part 1
What is Javascript? JavaScript (/ˈdʒævəˌskrɪpt/[5]) is a high-level, dynamic, untyped, and interpreted programming language.[6] It has been standardized in the ECMAScript language specification.[7] Alongside HTML and CSS, JavaScript is one of the three core technologies of World Wide Web content production; the majority of websites employ it, and all modern Web browsers support it without the need for plug-ins.[6] JavaScript is prototype-based with first-class functions, making it a multi-paradigm language, supporting object-oriented,[8] imperative, and functional programming styles.[6] It has an API for working with text, arrays, dates and regular expressions, but does not include any I/O, such as networking, storage, or graphics facilities, relying for these upon the host environment in which it is embedded.[7] (https://en.wikipedia.org/wiki/JavaScript) Javascript is a client-side scripting (programming) janguage Java and Javascript are NOT the same thing
Java vs Javascript Java is an Object Oriented Programming (OOP) language created by James Gosling of Sun Microsystems. JavaScript is a scripting language that was created by the fine people at Netscape and was originally known as LiveScript. JavaScript is a (very) distant cousin of Java in that it is also an OOP language. Many of their programming structures are similar. However, JavaScript contains a much smaller and simpler set of commands than does Java. It is easier for the average weekend warrior to understand. (http://www.htmlgoodies.com/beyond/javascript/article.php/3470971)
Programing 101 Syntax – The syntax of a language is the structure and rules/commands of the language. The Syntax of javascript is similar to the java language Javascript has the same support for variables, programming methods/instructions and operators that most full-languages have.
Javascript Basics Javascript is NOT a markup language Javascript is a scripting language Does not need to be compiled Runs in a browser Variables in javascript are “Loosely typed” http://blog.jeremymartin.name/2008/03/understanding-loose-typing-in.html Javascript can be included in an HTML page with the <script> tag or in an external “.js” file. Javascript operates on the “Client-side” and not the server side.
What is Javascript for? Javascript allows for a dynamic webpage and user interaction. It is one of the 3 fundamental/foundational languages of the internet (HTML, CSS, Javascript) Javascript allows your page to update dynamically and update information on the page based on user input (ex. Mortgage calculator - http://www.hughcalc.org/msimple_js.html)
Hello World! Javascript “Hello World” Alert Box <!DOCTYPE html> <body> <script> alert('Hello, World!') </script> </body> </html>
Sample Javascript <!DOCTYPE html> <html> <body> <h1>Hello World!</h1> <button type="button" onclick="myFunction()">Set background image</button> <script> function myFunction() { document.body.style.backgroundColor = "#f3f3f3"; document.body.style.backgroundImage = "url('img_tree.png')"; } </script> </body> </html>
Javascript tutorial https://autotelicum.github.io/Smooth-CoffeeScript/literate/js-intro.html
Additional Resources W3 Schools Javascript tutorial: http://www.w3schools.com/js/ Javascript tutorials: http://www.htmlgoodies.com/primers/jsp/ https://www.sitepoint.com/javascript/ http://htmldog.com/guides/javascript/ https://youtu.be/fGdd9qNwQdQ?list=PLoYCgNOIyGACTDHuZtn0qoBdpzV9c327V https://www.youtube.com/watch?v=fju9ii8YsGs Javascript scripts and code resources: http://www.codeave.com/javascript/default.asp