Final Key
Final Key
Scene
#7
Elizabeth: Captain Barbosa, I am here Barbossa: There are a lot of long words in
to negotiate the cessation of hostilities
against Port Royal.
there, Miss.
What is it that you want?
Elizabeth: I want you to leave and never come back.
Barbossa: I'm disinclined to acquiesce to your request. Means "no."
1 of 5
2. Javascript/DOM
window.onload = loadq2;
function loadq2() {
var del = document.getElementById("del");
del.onclick = divideAll;
}
function divideAll() {
var divisor = document.getElementById("divisor").value;
var div = document.getElementById("q2buttons");
var buttons = div.getElementsByTagName("button");
for (var i = 0; i < buttons.length; i++) {
if (buttons[i].innerHTML % divisor == 0) {
div.removeChild(buttons[i]);
i--;
}
}
}
or:
window.onload = loadq2;
function loadq2() {
var del = document.getElementById("del");
del.onclick = divideAll;
}
function divideAll() {
var divisor = document.getElementById("divisor").value;
var div = document.getElementById("q2buttons");
while (div.firstChild.innerHTML % divisor == 0) {
div.removeChild(div.firstChild);
}
var button = div.firstChild;
while (button.nextSibling) {
if (button.nextSibling.innerHTML % divisor == 0) {
div.removeChild(button.nextSibling);
}
}
}
2 of 5
3. Ajax/XML
window.onload = loadq3;
function loadq3() {
ajaxHelper("movie.xml", displayLines);
}
function displayLines(ajax) {
var q3html = document.getElementById("q3html");
var character = ajax.responseXML.getElementsByTagName("character")[0];
var lines = character.getElementsByTagName("line");
for (var i = 0; i < lines.length; i++) {
var time = lines[i].getAttribute("time");
var text = lines[i].firstChild.nodeValue;
var p = document.createElement("p");
p.innerHTML = "(" + time + ") " + text;
q3html.appendChild(p);
}
}
3 of 5
4. PHP
<?php
include("q4top.html");
$name = $_POST["name"];
$cc = $_POST["cc"];
$pw = $_POST["pw"];
include("q4bottom.html");
?>
4 of 5
5. SQL
SELECT DISTINCT c1.Role
FROM Movie m1, Movie m2, Cast c1, Cast c2
WHERE c1.Role = c2.Role
AND c1.mid = m1.id
AND c2.mid = m2.id
AND m1.name LIKE "%Pirates of the Caribbean%"
AND m2.name LIKE "%Pirates of the Caribbean%"
ORDER BY c1.Role;
or:
SELECT DISTINCT c1.Role
FROM Movie m1, Movie m2, Cast c1, Cast c2
WHERE c1.aid = c2.aid
AND c1.mid = m1.id
AND c2.mid = m2.id
AND m1.name LIKE "%Pirates of the Caribbean%"
AND m2.name LIKE "%Pirates of the Caribbean%"
ORDER BY c1.Role;
5 of 5