\t\t\t\t\t\t\t HTML
\nslide11. Event-driven programming CS380 11 split breaks apart a string into an array using a delimiter\ncan also be used with regular expressions (seen later)\njoin merges an array into a single string, placing a delimiter between them
\nslide12. Event-driven programming CS380 12 you are used to programs start with a main method (or implicit main like in PHP)\nJavaScript programs instead wait for user actions called events and respond to them\nevent-driven programming: writing programs driven by user events\nLet's write a page with a clickable button that pops up a \"Hello, World\" window...
\nslide13. Event handlers JavaScript functions can be set as event handlers\nwhen you interact with the element, the function will execute\nonclick is just one of many event HTML attributes one can use\nbut popping up an alert window is disruptive and annoying\nA better user experience would be to have the message appear on the page... CS380 13 ...\t\t\t\t\t\t\t\t\t\t HTML \t\t\t\t\t\t\t\t\t HTML
\nslide14. Document Object Model (DOM) most JS code manipulates elements on an HTML page\nwe can examine elements' state\ne.g. see whether a box is checked\nwe can change state\ne.g. insert some new text into a div\nwe can change styles\ne.g. make a paragraph red 14
\nslide15. DOM element objects 15
\nslide16. Accessing elements: document.getElementById CS380 16 var name = document.getElementById(\"id\");\n\t\t \t\t \t \t \t JS \nreplace me\n\t\t\t HTML function changeText() {\n\tvar span = document.getElementById(\"output\");\n\tvar textBox = document.getElementById(\"textbox\");\n\t\n\t textbox.style.color = \"red\"; \n\t\t\n}\t\t \t\t \t \t \t JS
\nslide17. Accessing elements: document.getElementById CS380 17 document.getElementById returns the DOM object for an element with a given id\ncan change the text inside most elements by setting the innerHTML property\ncan change the text in form controls by setting the value property
\nslide18. Handling latency Network latency is a major challenge in programming web applications\nUsed to handle using event listeners and handlers\nRecent improvements have made life much easier for JS programmers
\nslide19. Promises A promise returns an object that represents the eventual completion of an asynchronous request, and its resulting value var promise1 = new Promise(function(resolve, reject) \n\t{ set" }

JS Basics September 26th 2019 What is it? The

JS Basics September 26th 2019 What is it? The
1 / 1
JS Basics September 26th 2019 What is it? The - slide 1 of 23 JS Basics September 26th 2019 What is it? The - slide 2 of 23 JS Basics September 26th 2019 What is it? The - slide 3 of 23 JS Basics September 26th 2019 What is it? The - slide 4 of 23 JS Basics September 26th 2019 What is it? The - slide 5 of 23 JS Basics September 26th 2019 What is it? The - slide 6 of 23 JS Basics September 26th 2019 What is it? The - slide 7 of 23 JS Basics September 26th 2019 What is it? The - slide 8 of 23 JS Basics September 26th 2019 What is it? The - slide 9 of 23 JS Basics September 26th 2019 What is it? The - slide 10 of 23 JS Basics September 26th 2019 What is it? The - slide 11 of 23 JS Basics September 26th 2019 What is it? The - slide 12 of 23 JS Basics September 26th 2019 What is it? The - slide 13 of 23 JS Basics September 26th 2019 What is it? The - slide 14 of 23 JS Basics September 26th 2019 What is it? The - slide 15 of 23 JS Basics September 26th 2019 What is it? The - slide 16 of 23 JS Basics September 26th 2019 What is it? The - slide 17 of 23 JS Basics September 26th 2019 What is it? The - slide 18 of 23 JS Basics September 26th 2019 What is it? The - slide 19 of 23 JS Basics September 26th 2019 What is it? The - slide 20 of 23 JS Basics September 26th 2019 What is it? The - slide 21 of 23 JS Basics September 26th 2019 What is it? The - slide 22 of 23 JS Basics September 26th 2019 What is it? The - slide 23 of 23
JS Basics September 26th 2019 What is it? The standard programming language of the web Used on 95 of all websites Great resource for beginners Client-side scripting Tells web pages what to do when things change Server-side scripting Tells

Related Topics

Download this presentation From Below

"JS Basics September 26th 2019 What is it? The" is the property of its rightful owner. Permission is granted to download and print the materials on this website for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.

Presentation Transcript

01
JS Basics September 26th 2019<br>
02
What is it? The standard programming language of the web
Used on 95% of all websites
Great resource for beginners
Client-side scripting
Tells web pages what to do when things change
Server-side scripting
Tells server what to do when things change<br>
03
Key characteristics Interpreted, scripting language
Prototype-based
Supports first-class functions
Event-based programming paradigm<br>