1 / 19

DOM, Multimedia and Widgets

DOM, Multimedia and Widgets. 20 February 2014. Trees and DOM. Trees. Navigating a Tree. NodeA.firstChild  = NodeA1 NodeA.lastChild  = NodeA3 NodeA1.parentNode  = NodeA NodeA1.nextSibling = NodeA2 NodeA3.prevSibling = NodeA2 NodeA.lastChild.firstChild  = NodeA3a. Relating To HTML.

neka
Download Presentation

DOM, Multimedia and Widgets

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. DOM, Multimedia and Widgets 20February 2014

  2. Trees and DOM

  3. Trees

  4. Navigating a Tree • NodeA.firstChild = NodeA1 • NodeA.lastChild = NodeA3 • NodeA1.parentNode = NodeA • NodeA1.nextSibling = NodeA2 • NodeA3.prevSibling = NodeA2 • NodeA.lastChild.firstChild = NodeA3a

  5. Relating To HTML • Look at Inspect Element Root = HTML Children and siblings • Structure is called the DOM Document Object Model • CSS will allow us to format selectively based on the tree

  6. CSS Selectors • context tag { • Applies to any tag inside context • Space is a descendant selector • context > tag { • Applies to any tag directly inside context • > is a child selector • Context + tag { • Applies only to a tag that DIRECTLY follows a context • + is an adjacent sibling selector

  7. Fun Additions to Websites

  8. Sound Options • You can add it to the page – not recommended • Widgets (coming next) • Natively in HTML5 <audio controls> <source src="h.wav" type="audio/wav"> </audio> Warning: may not work until uploaded

  9. Videos • Options • Widgets (coming next) • Iframes (Youtube) • Natively in HTML5 <video controls> <source src="m.mp4" type="video/mp4" /> </video> Warning: may not work until uploaded

  10. Other Documents • Object <object data="cauliflower.pdf"></object> • pdf: can open in a browser, but not part of your website

  11. JavaScript and Widgets

  12. Review: Viewing a Web Page SERVER web page repository WEB PAGE instructions stores information and instructions BROWSER retrieves web page and follows instructions 2 1 3 Server Client Web Server Pages Browser

  13. Dynamic Web Pages • Two places you can change • Browser: JavaScript • Server: php • General rule: • do it in the browser if you can • Why? • Distribute the work • Consider the difference in the time function… 2 1 3 Server Client Web Server Pages Browser

  14. What is JavaScript? • Functions • simple programming tool • dynamic text • react to events • read and write HTML elements • w3schools

  15. HTML Content CSS Presentation JavaScript Behavior Three Legged Stool

  16. Widgets • A chunk of code that you can embed in an existing environment • Differences • Resides: desktop or web • Embedding: any page or application or limited • Runs: your machine or server

  17. Widget Websites • Lots of sites • See resources • Or just Google • Let’s add some to a web page • Adding • Formatting: • Enclose in div • position and format • Warning: make sure that your browser isn’t blocking them

  18. Problems with Widgets • They have divs in them that you can’t see • Implicaton: if you format all divs, it applies to the ones in the widget • Solution: name all divs with class or use section or main, header, … • They may use & or blank in URLs • Implication: won’t validate • Solution: replace all &s with &amp; and all blanks with %20 • They may be old • Don’t use if too many obsolete tags

  19. Steps for adding a widget • Assure that you have no unnamed divs • Layout your page with a placeholder div that is the size of the widget that you are going to add • Add the widget inside the div • Assure that it looks the way that you want • Format the embedded code without any changes • Replace all inline formatting with classes and css • Assure that it still looks right • Eliminate any unneeded tags or css entries • Assure that it still looks right • Replace all & and blanks as needed • Validate

More Related