===== CS 328 - Week 13 Labs - 2024-04-19 ===== ===== TODAY WE WILL ===== * announcements * a few words about JavaScript syntax * Week 13 Lab Exercise ===== * should be working on Homework 10 * at-least-first-attempts due by 11:59 pm on TUESDAY, April 23 (because posted late) * watch for class e-mail when Homework 11 is posted * should be reading/doing activities in zyBooks Chapter 6 - More PHP AND now also zyBooks Chapter 7 - JavaScript Fundamentals * deadline to complete these: 11:59 pm pm Friday, May 3 * an initial set of CS 328 JAVASCRIPT CLASS CODING STANDARDS is now posted on the course public web site, as is an initial page of additional JAVASCRIPT REFERENCES ===== * CS FACULTY CANDIDATES should be giving their TEACHING TALKS during the next THREE Wednesdays in CS 328: * Wednesday, April 17 * Wednesday, April 24 * Wednesday, May 1 * the FIRST 45 minutes will be their talks, FOLLOWED by CS 328 course material for the REST of those class sessions * RECORDINGS will be posted to supplement for the missed class time * Because of the importance of student feedback on these candidates, you will receive 2 clicker questions' credit for attending their talks * (and there WILL be at least one actual clicker question during the class material following) * Let me know if you have any questions about this!! ===== a few introductory bits of JavaScript syntax... ===== * JavaScript style: name variables and functions and methods in camelCase * In JavaScript, variable names do NOT have to start with a $ (in fact, better NOT to start with $, because many JavaScript libraries use that convention...) * it is considered GOOD STYLE to declare variables using let or var (I tend to use let): (and it is fine to initialize and declare in the same statement) let message; let count = 0; count = "backwards"; * the Document Object Model (DOM) basically gives JavaScript a way to access and affect the currently-executing HTML document, mapping each element to a JavaScript object... * in the DOM, client-side JavaScript can access parts of the currently-executing HTML document using an object named document and all of the elements in the current HTML document have corresponding objects that are descendants in document * one handy method of document: getElementById * expects the value of an id attribute * returns a reference to the DOM object representing that particular element in the current document * DOM gives a means to make changes to the currently-executing HTML document within a browser -- but note it is just changing that executing copy (it is NOT changing the original from its web server in any way!) * and each DOM object has methods and data fields available for it... * BE CAREFUL -- sometimes the data fields correspond to an HTML element's attribute name, and sometimes they don't!!! * two examples: * the DOM object for an input with type="text" has a value data field, and its value is the current contents of that textfield * the DOM object of a non-void element includes a data field named innerHTML that represents it contents