The Essential Guide to HTML5

(Greg DeLong) #1

QUIZ


Code Explanation


document.body.appendChild(d);


thingelem = document.
getElementById(uniqueid);


thingelem.textContent=facts[c][0];


thingelem.style.top =
String(my)+"px";


thingelem.style.left =
String(mx)+"px";


thingelem.addEventListener
('click',pickelement,false);


uniqueid = "p"+String(c);


d = document.createElement
('cap');


d.innerHTML = (


"<div class='thing'
id='"+uniqueid+"'>placeholder

");


document.body.appendChild(d);


thingelem = document.
getElementById(uniqueid);


thingelem.textContent=facts[c][1];


do {s = Math.floor
(Math.random()*nq);}


while (slots[s]>=0)


slots[s]=c;


thingelem.style.top =
String(row1+s*rowsize)+"px";

Free download pdf