Logo  

CS479/579 - Web Programming II

ECMAScript (formerly JavaScript) review:

An element:

  • HTML/CSS:
    <div id='el' style='border:1px solid black; font-size; 12pt;'> ABC </div>

  • Finding the element:

var e = document.getElementById("el");
e.innerHTML == "ABC";
  • Creating it with pure ES:
var div = document.createElement("div");
div.id = "el";
div.style.border = "1px sold black";
div.style.fontSize = "12pt";
div.innerHTML = " ABC ";
X.appendChild(div);
// where <X> is the element in which we want to place the above div.

ECMAScript examples:

These examples demonstrate basic ES scripting examples