Javascript example

rock-paper-scissors




XSS / Code injection

A page can load javascript from anywhere.

  

When users can edit website content, use PHP's:






Popup windows

window.open("http://example.com", "new window", options)





DOM

https://developer.mozilla.org/en/DOM

Document Object Model - object-oriented representation of a web page

An object is created for every element (tag) on the page

    <a href="http://example.com" id="mylink1">link</a>

generates an HTMLAnchorElement object, which contains its attributes (such as href), its style information, its children and parent pointers, etc




function $(name)
  {
  return document.getElementById(name)
  }


Creative Commons License
This document is by Dave Pape, and is released under a Creative Commons License.