\t\t\t\t\t\t\t HTML
\nslide12. Event-driven programming 12 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 CS380
\nslide13. A JavaScript statement: alert a JS command that pops up a dialog box with a message CS380 13 alert(\"IE6 detected. Suck-mode enabled.\");\t\t\t\t\t\t\t \t\t JS
\nslide14. Event-driven programming 14 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... CS380
\nslide15. Buttons button's text appears inside tag; can also contain images\nTo make a responsive button or other UI control:\nchoose the control (e.g. button) and event (e.g. mouse 1. click) of interest\nwrite a JavaScript function to run when the event occurs\nattach the function to the event on the control CS380 15 \t\t\t\t\tHTML
\nslide16. JavaScript functions 16 function name() {\nstatement ;\nstatement ;\n...\nstatement ;\n}\t\t \t\t \t \t \t JS the above could be the contents of example.js linked to our HTML page\nstatements placed into functions can be evaluated in response to user events function myFunction() {\n\talert(\"Hello!\");\n\talert(\"How are you?\");\n} \t \t\t \t \t \t JS CS380
\nslide17. 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 we'll 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 17 ...\t\t\t\t\t\t\t\t\t\t HTML \t\t\t\t\t\t\t\t\t HTML
\nslide18. 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 18
\nslide19. DOM element objects 19
\nslide20. Accessing elements: document.getElementById 20 var name =" }

Intro to Javascript CS380 1 Client Side Scripting

Intro to Javascript CS380 1 Client Side Scripting
1 / 1
Intro to Javascript CS380 1 Client Side Scripting - slide 1 of 40 Intro to Javascript CS380 1 Client Side Scripting - slide 2 of 40 Intro to Javascript CS380 1 Client Side Scripting - slide 3 of 40 Intro to Javascript CS380 1 Client Side Scripting - slide 4 of 40 Intro to Javascript CS380 1 Client Side Scripting - slide 5 of 40 Intro to Javascript CS380 1 Client Side Scripting - slide 6 of 40 Intro to Javascript CS380 1 Client Side Scripting - slide 7 of 40 Intro to Javascript CS380 1 Client Side Scripting - slide 8 of 40 Intro to Javascript CS380 1 Client Side Scripting - slide 9 of 40 Intro to Javascript CS380 1 Client Side Scripting - slide 10 of 40 Intro to Javascript CS380 1 Client Side Scripting - slide 11 of 40 Intro to Javascript CS380 1 Client Side Scripting - slide 12 of 40 Intro to Javascript CS380 1 Client Side Scripting - slide 13 of 40 Intro to Javascript CS380 1 Client Side Scripting - slide 14 of 40 Intro to Javascript CS380 1 Client Side Scripting - slide 15 of 40 Intro to Javascript CS380 1 Client Side Scripting - slide 16 of 40 Intro to Javascript CS380 1 Client Side Scripting - slide 17 of 40 Intro to Javascript CS380 1 Client Side Scripting - slide 18 of 40 Intro to Javascript CS380 1 Client Side Scripting - slide 19 of 40 Intro to Javascript CS380 1 Client Side Scripting - slide 20 of 40 Intro to Javascript CS380 1 Client Side Scripting - slide 21 of 40 Intro to Javascript CS380 1 Client Side Scripting - slide 22 of 40 Intro to Javascript CS380 1 Client Side Scripting - slide 23 of 40 Intro to Javascript CS380 1 Client Side Scripting - slide 24 of 40 Intro to Javascript CS380 1 Client Side Scripting - slide 25 of 40 Intro to Javascript CS380 1 Client Side Scripting - slide 26 of 40 Intro to Javascript CS380 1 Client Side Scripting - slide 27 of 40 Intro to Javascript CS380 1 Client Side Scripting - slide 28 of 40 Intro to Javascript CS380 1 Client Side Scripting - slide 29 of 40 Intro to Javascript CS380 1 Client Side Scripting - slide 30 of 40 Intro to Javascript CS380 1 Client Side Scripting - slide 31 of 40 Intro to Javascript CS380 1 Client Side Scripting - slide 32 of 40 Intro to Javascript CS380 1 Client Side Scripting - slide 33 of 40 Intro to Javascript CS380 1 Client Side Scripting - slide 34 of 40 Intro to Javascript CS380 1 Client Side Scripting - slide 35 of 40 Intro to Javascript CS380 1 Client Side Scripting - slide 36 of 40 Intro to Javascript CS380 1 Client Side Scripting - slide 37 of 40 Intro to Javascript CS380 1 Client Side Scripting - slide 38 of 40 Intro to Javascript CS380 1 Client Side Scripting - slide 39 of 40 Intro to Javascript CS380 1 Client Side Scripting - slide 40 of 40
Intro to Javascript CS380 1 Client Side Scripting CS380 2 Why use client-side programming? PHP already allows us to create dynamic web pages. Why also use client-side scripting? client-side scripting (JavaScript) benefits: usability: can

Related Topics

Download this presentation From Below

"Intro to Javascript CS380 1 Client Side Scripting" 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
Intro to Javascript CS380 1<br>
02
Client Side Scripting CS380 2<br>
03
Why use client-side programming? PHP already allows us to create dynamic web pages. Why also use client-side scripting?
client-side scripting (JavaScript) benefits:
usability: can modify a page without having to post back to the server (faster UI)
efficiency: can make small, quick changes to page without waiting for server
event-driven: can respond to user actions like clicks and key presses CS380 3<br>