-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathstart.html
69 lines (64 loc) · 2.4 KB
/
start.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello, Javascript</title>
<link rel="stylesheet" type="text/css" href="http://cdnjs.cloudflare.com/ajax/libs/normalize/2.1.3/normalize.min.css">
<style>
body { width: 960px; margin: 40px auto; font-family: "Helvetica Neue"; }
#challenges { margin-top: 96px; background-color: #fffbb0; padding: 12px; }
code { font-weight: bold; padding: 0px 3px;}
</style>
<script src="http://code.jquery.com/jquery-2.0.3.min.js"></script>
</head>
<body>
<script>
$(document).ready(function() {
alert("The page is ready!");
$("#hide_and_show").on("click", function() {
$("h3").toggle();
$("ul").toggle();
})
$("#change_colors").on("click", function() {
$("li").css("color", "red");
});
$("#change_second").on("click", function() {
$("li:nth-child(2)").css("color", "red");
});
$("a").on("click", function(eventObject) {
alert("Nice try!");
alert(eventObject.pageX);
alert(eventObject.pageY);
eventObject.preventDefault();
});
});
</script>
<p>You should see an alert box as soon as this page loads.</p>
<p id="hide_and_show">Click Here to Toggle The Snack List.</p>
<p id="change_colors">Click here to change the color of the list items.</p>
<p id="change_second">Click here to change the color of the second item.</p>
<h3>Snack List</h3>
<ul>
<li>Ice Cream</li>
<li>Cookies</li>
<li>M&Ms</li>
</ul>
<a href="http://www.facebook.com">Catch up on both of my friends</a>
<a href="http://www.google.com">
Don't Search With Google
</a>
<div id="challenges">
<h2>Principles & Hints</h2>
<ol>
<li>Order matters.</li>
<li><code>alert("Hi");</code> will display a dialog box.</li>
<li>There are two built-in variables: <code>document</code> and <code>window</code>.</li>
<li>DOM traversal: <code>getElementsByTagName</code>, <code>getElementById</code>, etc.</li>
<li>DOM manipulation.</li>
<li>CSS manipulation. Example: <code>e.style.color = "red";</code></li>
<li>Default browser behaviors can be overridden.</li>
<li><code>console.log</code> in Javascript is like <code>puts</code> in Ruby.</li>
</ol>
</div>
</body>
</html>