
Benefits & History of JavaScript in Web Development
Discover the evolution of JavaScript from static web content to dynamic interactive experiences. Explore the reasons for its popularity, uses in modern web development, and key historical milestones. Learn how to integrate JavaScript into HTML and leverage its power to enhance user experiences and website functionality.
Download Presentation

Please find below an Image/Link to download the presentation.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.
You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.
E N D
Presentation Transcript
Javascript Notes 11/17/2022
Why JavaScript? Original Web was static What you got next time was what you saw this time Any Action had to come from the server Which cost bandwidth Which meant it looked less lively than TV Meanwhile the client computer was wasted, idle
Uses of JavaScript Load content without the whole page (AJAX or WebSocket) Animations & games Play streaming media Pop-up ads Validating forms before sending them Redirecting JavaScript is an interpreted language, meaning that it is evaluated and executed on the fly not compiled into machine language or pcode
A Little History First introduced as Live Script by Netscape Collaboration with Sun Microsystems Syntax very similar to Java New name: JavaScript Microsoft came up with jscript to compete ECMA formed a cross-platform standard for JavaScript Microsoft eventually moved to JavaScript JavaScript is implemented in all current graphical browsers
Server-Side JavaScript Node.js
How To Put JavaScript into HTML Tags in your code <script> <script> alert("Hello World, this is JavaScript") alert("Hello World, this is JavaScript") </script> </script> Include JavaScript from another file <script type= <script type="text/ text/javascript javascript" src src= ="script1.js script1.js"></script> ></script>
Two Common Approaches Inline code to be executed as the browser renders your page Procedures that can be called by on___ attributes of html, e.g. <p onclick="checkifvalid();"> <body onload="setupdialog();"> Although on___ parameters are usually procedure calls, they can be any JavaScript code
Changing an HTML element Change the value attribute of theHTML element with ID= mybutton document.getElementById document.getElementById(" Change the HTML in a <h1> tag document.getElementById document.getElementById( ("headline "News flash! News flash! " Change a style document.getElementById document.getElementById(" dColor dColor=" ="lightblue lightblue"; "; ("mybutton mybutton").value="Hello" ").value="Hello" headline"). ).innerHTML innerHTML= = ("myplace myplace"). ").style.backgroun style.backgroun
RS1 Rosetta Stone JavaScript statements may end in a semicolon If not, the interpreter will make a judgment for you Capitalization is critical Note that JavaScript has many built-in functions with interesting capitalization // makes the rest of a line a comment
RS2 Variables are created by the var statement They are given a type according to what data you put into them var i i=5 // Put a number 5 into variable I =5 // Put a number 5 into variable I var j= var j= " 5 5 "// Put a string containing 5 into j // Put a string containing 5 into j You can use const Syntax is similar to most modern languages E.g. for (x=1; x<=y; x++) { for (x=1; x<=y; x++) { doSomething constfor values that won t change doSomething(); } (); }
RS3 String concatenation character is + If either argument next to the + is a string, result is a string Common debugging statements: alert() console.write()
Form Validation https://www.w3schools.com/js/js_validation.as p
Arrays https://www.w3schools.com/js/js_arrays.asp